数据库获取前N条记录SQL Server与SQLite的区别
在使用sql语句进行前20条记录查询时SQL Server可以这样写:
1: select top 20 * from [table] order by ids desc
2: select top 20 * from [table] where id not in (select top 20 id from [table] )
3: select top 20 * from (select top 30 * from [table] order by id) as tb1 order by tb1.id
而在SQLite中要这样用:
1:select * from [table] order by id limit 20