Oracle数据库查询
怎样用SQL语句实现查找一列中第N大值?
Select top 1 sal from emp where empno not in(
Select top N-1 empno from emp order by sal desc
) order by sal desc;
Select * from (select * from 表 order by 列名 desc) where Rownum<=N
Minus
Select * from (select * from 表 order by 列名 desc) where Rownum<=N-1
Rownum 返回记录的条数。
如何删除一个表里面的重复行?
获取某个字段的最后三个字符的函数是什么?
Substr(name,,length(name)-2)
delete from tablename where id not in (select max(id) from tablename group by col1,col2,...) id为唯一标识