Welcome 微信登录

首页 / 数据库 / MySQL / Oracle获取某字段不重复的记录

方法:使用Row_number() over (partition by col1 order by col2)
该方法先根据col1分组,然后根据col2排序,最后每组均从1开始编号sql语句
select * from
(select id,Row_number() over (partition by id order by id) rn from table1) t
where rn=1Oracle可转换的类型赋值Linux 下MySQL的安装和远程设置相关资讯      oracle 
  • [INS-32052] Oracle基目录和Oracle  (07/22/2014 07:41:41)
  • Oracle 4个大对象(lobs)数据类型  (02/03/2013 12:33:05)
  • Oracle按时间段分组统计  (07/26/2012 10:36:48)
  • [Oracle] dbms_metadata.get_ddl的  (07/12/2013 07:37:30)
  • Liferay Portal 配置使用Oracle和  (07/31/2012 20:07:18)
  • Concurrent Request:Inactive   (07/20/2012 07:44:05)
本文评论 查看全部评论 (0)
表情: 姓名: 字数