[ILUG] OT: SQL query problem.....
gleng at bsolved.com
Thu Jun 10 20:54:59 IST 1999
I have a bit of a problem at work. I have an Oracle table that acts as a
message queue for part of a project I've been working on. I'm having a
bit of trouble with what I thought would have been a simple SQL query.
Basically I need to be able to grab the last n amount of records. Or to
put it another way, given a record's key, I need to retrieve the
previous n records, where n is the number of records I want (obvious I
So any ideas. I need it as basic SQL like "select * from table where
I've tried various attempts, the best way I could think of was to limit
the rownum to <=n and reverse the order. But the ordering only works
after result has been created.
recordid < (select max(recordid) from record_table)
I'd appreciate any help or tips.
More information about the ILUG