码迷,mamicode.com
首页 > 数据库 > 详细

oracle 按某个字段查询重复数据

时间:2016-11-24 18:13:32      阅读:160      评论:0      收藏:0      [点我收藏+]

标签:bsp   style   复数   查询   字段   log   class   pre   color   

 /*
 手机号为重复的会员,获取其最大会员id,对应的会员信息
 */
SELECT * FROM MEMBER a WHERE a.member_id IN (
SELECT MAX(member_id) FROM MEMBER b WHERE b.mobile  IN (SELECT mobile FROM (
                                                        SELECT t.mobile,t.mobile_state,t.is_delete FROM MEMBER t 
                                                        WHERE t.is_delete=NAND t.mobile_state=Y   AND t.mobile=mobile
                                                        GROUP BY t.mobile,t.mobile_state,t.is_delete HAVING COUNT(*)>1
                                                                                    )
                                ) 

 

oracle 按某个字段查询重复数据

标签:bsp   style   复数   查询   字段   log   class   pre   color   

原文地址:http://www.cnblogs.com/wangchuanfu/p/6098693.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!