Simple sql - how to select last 5 rows

this is really simple

how do you select the last n rows of a table


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:
view, visit, vote
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;

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

view, visit, vote

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