Finding duplicate in SQL Server Table

后端 未结 2 1242
天命终不由人
天命终不由人 2021-01-29 13:03

I have a table

+--------+--------+--------+--------+--------+
| Market | Sales1 | Sales2 | Sales3 | Sales4 |
+--------+--------+--------+--------+--------+
|            


        
2条回答
  •  滥情空心
    2021-01-29 13:18

    Supposing the data size is not so big, make a new temporay table joinning all data:

    Sales 
    Market
    

    then select grouping by Sales and after take the ones bigger than 1:

    select Max(Sales), Count(*) as Qty 
    from #temporary 
    group by Sales
    

提交回复
热议问题