Load data from sqldatabase... but in reverse order?

Hi,
I have my database set up alI fine and dandy…

But Im not sure how to code this… I want to read my records in, in reverse order…

So my current code looks like this

*db being my database
[lua]for row in db:nrows(“SELECT * FROM listsMain”) do

end[/lua]
This bring my records in from first record entered to last record entered.

how do I load from last record entered to first record entered?
Thanks
Aidan
[import]uid: 102413 topic_id: 28488 reply_id: 328488[/import]

Hi, first of all you need a column to sort the records from. It could be a number or a string.

If you are having a id of integer you could sort by

select \* from Animal order by id asc  

this sort the result ascending.

or

select \* from Animal order by id desc  

sorted descending

Joakim [import]uid: 81188 topic_id: 28488 reply_id: 114964[/import]

ahhh sweet,
I will give that ago when I get home.

Thanks
for that! [import]uid: 102413 topic_id: 28488 reply_id: 115022[/import]