Re: SQL TRICK. Select rowid, max(...) (fwd)
Posted in 1994
Michal Hobot writes:
> Dima Rasnitsyn (rasnitsn@milcse.rtsg.mot.com) wrote:
> : Hi!
> : Could anybody suggest me some SQL trick for selecting rowid of row with a max
> Try this:
>
> SELECT rowid
> FROM mytable
> WHERE <my conditions>
> ORDER BY col1 DESC>
> And then fetch one row !
>
> It runs, and it runs fast.
>
> Michal Hobot
> doctorQ Computers
> doctorq@sam.nask.com.pl
>
>
using sql, you get the following results:
SELECT rowid
FROM systables
WHERE tabid >= 100
ORDER BY tabname DESC
309: ORDER BY column (tabname) must be in SELECT list.
Error in line 4Near character position 17
--
regards,
+----------------------------------------------------------------------------+
| . . | |
| ... ... | Bob Baskett |
| ..... ..... | Software Engineer, DBA |
| .. ... .. | Business Systems Integration Group |
| . . . | Semiconductor Products Sector |
| | Mesa, AZ |
| Motorola, Inc. | |
|----------------------------------------------------------------------------|
| 'connectionLESS IS MORE' -- Data Broker |
|----------------------------------------------------------------------------|
| Duct tape is like the force. It has a light side, and a dark side, and |
| it holds the universe together ... |
| -- Carl Zwanzig |
+----------------------------------------------------------------------------+