Getting the last 30 rows
How can you get the last 30 rows (i.e. the last 30 rows to be inserted) into a database us开发者_Python百科ing SQL?
SELECT * FROM table LIMIT x,y ?
An example table:
USER: id (auto increment, int, pk), username, email
SELECT * FROM table ORDER BY id DESC LIMIT 30
you would have to have some key to go with... is there an auto-incrementing column, then order by THAT column descending... Ex:
select * from YourTable order by TheAutoIncrementColumn DESC limit 30
精彩评论