SQL查询数据库中重复的数据

 

   select  a.mobel,COUNT(a.mobel) as '出现次数' from CustomerData.dbo.VeryImporntPerson_2  a where  --CustomerData.dbo.VeryImporntPerson_2 要查询的表的
 a.id > (select min(b.id) from CustomerData.dbo.authors1  b where b.mobel = a.mobel and   --CustomerData.dbo.authors1  要比较的数据表
  b.area='江苏-南京' and a.area='江苏-南京')
 and a.classType='保险理财客户' and a.area='江苏-南京'
  group by a.mobel order by COUNT(a.mobel) desc   --按手机号分组
 
 

posted on 2013-05-17 10:30  骑蟋蟀的蝈蝈  阅读(217)  评论(0)    收藏  举报

导航