重复ypid查询,重复记录查询,准确

 

SELECT fangjianhao, xiaoshouzhuangtai, dingjiadanjia

FROM S_fangyuanxinxi a
WHERE (loupanmingcheng = '陶然庭苑小区') AND
          ((SELECT COUNT(*)
          FROM S_fangyuanxinxi
          WHERE fangjianhao = a.fangjianhao AND loupanmingcheng = '陶然庭苑小区') 
      > 1)

 

---------多字段重复,a.loupan, a.niandu, a.fangjianhao, a.biaozhunmingcheng   四个字段重复

SELECT *
FROM (SELECT a.loupan, a.niandu, a.fangjianhao, a.biaozhunmingcheng
FROM W_fangjian_yishoukuan a INNER JOIN
(SELECT loupan, niandu, fangjianhao, biaozhunmingcheng
FROM W_fangjian_yishoukuan
GROUP BY loupan, niandu, fangjianhao, biaozhunmingcheng
HAVING COUNT(*) > 1) b ON a.loupan = b.loupan AND 
a.niandu = b.niandu AND a.fangjianhao = b.fangjianhao AND 
a.biaozhunmingcheng = b.biaozhunmingcheng) a
WHERE (loupan = '陶然庭苑小区')
ORDER BY loupan, niandu, fangjianhao, biaozhunmingcheng

  

 

 

 

 

 

 

  

 

posted on 2017-03-20 18:50  那里的天空  阅读(1697)  评论(0编辑  收藏  举报

导航