我要返回MYSQL 5.0中最后5条记录,SQL语句这样写:SELECT *,(SELECT count(*) AS n from book_inf) FROM book_inf where limit n-5,5
。但是出错:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'limit n-5,5' at line 1 。我用的asp.net 2.0,请问怎么样才能达到我的要求。谢谢了!
。但是出错:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'limit n-5,5' at line 1 。我用的asp.net 2.0,请问怎么样才能达到我的要求。谢谢了!
SELECT @rownum:=@rownum+1 rownum, t.*FROM (SELECT @rownum:=0) r, book_inf t order by rownum desc
LIMIT 0,5;