SQL指令:找出TABLE內是否存在(欄位相同)重複的資料


一般:

select * from table where name in (select name from

table group by name having count(*)>1)


實例:

select *
from H.c60 a
where (a.SYS,a.CRMYY,a.CRMID,a.CRMNO)
in (select b.sys,b.CRMYY,b.CRMID,b.CRMNO
from H.c60 b
group by (b.sys,b.CRMYY,b.CRMID,b.CRMNO)
having count(*)>1)

arrow
arrow
    全站熱搜

    nan 發表在 痞客邦 留言(0) 人氣()