delete from aa where 
(select disictn aa.c1 from aa)

解决方案 »

  1.   

    declare @mycount int,
     case when (select count(aa.cl) as mycount>1 from aa group by aa.cl) then (delete from aa top @mycount-1 order by aa.c2 group by aa.c1) else when (select count(aa.cl) as mycount>1 from aa group by aa.c2)) then (delete from aa top @mycount-1 order by aa.c1 group by aa.c2)
      

  2.   

    有点问题应该是
    declare @mycount int,
     case when (select count(aa.cl) as mycount>1 from aa group by aa.cl) then (delete from aa top @mycount-1 order by aa.c2 DESC group by aa.c1) else when (select count(aa.cl) as mycount>1 from aa group by aa.c2)) then (delete from aa top @mycount-1 order by  DESC aa.c1 group by aa.c2) END CASE
      

  3.   

    delete from aa 
    where aa.c2<>(select c2 from (select distinct(c1),c2 from aa))
    or(aa.c1<>(select c1 from (select distinct(c2),c1 from aa)))
      

  4.   

    select * from aa where aa.c1 in(select distinct aa.c1 from aa)
      

  5.   

    delete from aa 
    where aa.c2<>(select c2 from (select distinct(c1),c2 from (select*from aa order by c2))
    or(aa.c1<>(select c1 from (select distinct(c2),c1 from (select*from aa order by c1))))