How to query SQL Table and remove duplicate rows from a result set

前端 未结 3 2036
感动是毒
感动是毒 2020-12-21 19:26

I know this is simple...

Please advise on how I can get a result set of rows 1, 9, 18, and 21 (based on the attached image)??

Thanks,

Brad

<

3条回答
  •  盖世英雄少女心
    2020-12-21 19:35

    Since there exists a redundant data in your table you can use the following approach:-

    Create a temp table (with same schema as of your attached image table) and execute this query:-

    Insert into [temptable]
    Select [all column names] from [table]
    union
    Select [all column names] from [table]
    

    afterwards you can truncate data from your original table and then do insert from temptable to original table.

提交回复
热议问题