Simple sql - how to select last 5 rows

this is really simple

how do you select the last n rows of a table

cheers

dion


www.blogsaic.com
view, visit, vote

found the answer

the mysql way is to use ‘limit’

the Microsoft way is to use ‘TOP’

On 10/25/06, Dion H. [email protected] wrote:

www.blogsaic.com
view, visit, vote


www.blogsaic.com
view, visit, vote

The methods vary depending on which database you are talking to. But,
generally you would sort the table in reverse order then limit the
results to the first 5 rows.

In MySQL it would be something like:

select * from sometable order by somecolumn DESC LIMIT 5;

-Larry
On 10/24/06, Dion H. [email protected] wrote:

view, visit, vote


Best Regards,
-Larry
“Work, work, work…there is no satisfactory alternative.”
— E.Taft Benson