select xm,csrq
from table
group by xm,csrq
having count(*)>1

解决方案 »

  1.   

    select xm, count(xm) from table
     group by xm
     having count(xm)>1
      

  2.   

    Select * From tablename Where xm + Convert(Varchar(10), csrq, 121) In (Select xm + Convert(Varchar(10), csrq, 121) From tablename Group by xm, Convert(Varchar(10), csrq, 121) Having Count(*) >= 2)
      

  3.   

    select * from yourtable order by xm,csrq
      

  4.   

    select xm,csrq,count(*) as num from yourtable
    group by xm,csrq
      

  5.   

    select t1.* from tab t1,
    (select xm,convert(varchar(10),csrq,120) as csrq from tab group by xm,convert(varchar(10),csrq,120) having count(*)>1) t2
    where t1.xm=t2.xm and convert(varchar(10),t1.csrq,120) =t2.csrq
      

  6.   

    select * from info t1 join info t2 on t1.xm=t2.xm and t1.csrq=t2.csrq