不知道这样算不算是一条~~~select * from A union select * from A

解决方案 »

  1.   

    Select Distinct * From A
      

  2.   

    Create Table A
    (Col1 Int,
     Col2 Int)
    Insert A Select 1,  2
    Union All Select 1,  2
    Union All Select 2,  5
    Union All Select 3,  4
    Union All Select 3,  4
    Union All Select 1,  3
    GO
    Select Distinct * From A
    GO
    Drop Table A
    --Result
    /*
    Col1 Col2
    1 2
    1 3
    2 5
    3 4
    */
      

  3.   

    不是查询,我要的是删除重复的记录.最好是一条SQl
      

  4.   

    一条sql不会多条sql的
    Select Distinct * into #b From A
    delete from A
    insert into A select *  from #bDrop table #b