一个数据库查询语句
查询出数据表中第30条到第40条记录。ID为关键字段,同时ID不是连续的。
答案:
T-SQL语法
select top 10 * from table where id>(select max(id) from (select top 30 id from table order by id) as tmptable) order by id
MYSQL数据库SQL语法
select id from tbl where id>(select max(id) from (select id from tbl order by id limit 0,10) as tmptable) order by id limit 0,10
浙公网安备 33010602011771号