Ah, thank you! I had a similar one but was doing an "asc" to get the
order I wanted, which doesn't make sense - I should sort the results
after I get them on my own.
Dennis
Igor Tandetnik wrote:
Dennis Volodomanov <info-+Tq6r2yh00lWk0Htik3J/[EMAIL PROTECTED]> wrote:
Hello all,
I can't seem to figure out a working SQL for the following condition,
and I'm not sure if it's possible in SQL at all (but hope it is).
Let's say I have a simple schema:
CREATE TABLE MyTable ( ID INTEGER PRIMARY KEY, SomeData )
What I'd like to get is 5 records (for example) that are immediately
before a given ID (where before means their ID is less than).
select * from MyTable
where ID < ?
order by ID desc limit 5;
Igor Tandetnik
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------