现在的位置: 首页 > 综合 > 正文

sql查询最后一条数据

2013年07月22日 ⁄ 综合 ⁄ 共 148字 ⁄ 字号 评论关闭

1、 sql查询最后一条数据select * from table order by id DESC limit 1

 

2、select top1 * from tablename where order by id desc

 

通过在mysql中测试,只有第一种可以使用,不知道其他数据库是否支持第二种方法,网上很多人说用第二种方法

抱歉!评论已关闭.