hibernate 查询最后一条
- 作者: 精中罩38C
- 来源: 51数据库
- 2021-01-26
select * from table
where rownum<(select count(*)+1 from table)
minus
select * from table
where rownum<(select count(*) from table)
也可以简化为
select * from table
minus
select * from table
where rownum<(select count(*) from table)
效果是一样的
切记rownum是伪列 只能用<
顺便给你求第X行的通用SQL语句
select * from table where rownum<X+1
minus
select * from table where rownum<X
where rownum<(select count(*)+1 from table)
minus
select * from table
where rownum<(select count(*) from table)
也可以简化为
select * from table
minus
select * from table
where rownum<(select count(*) from table)
效果是一样的
切记rownum是伪列 只能用<
顺便给你求第X行的通用SQL语句
select * from table where rownum<X+1
minus
select * from table where rownum<X
推荐阅读
