I am looking to make a query in SQL SERVER that will allow me to display in a grouping the string that appears in most cases. Not the amount, not the maximum, but the string that is displayed in most cases:
| colA | colB | colC |
|---|---|---|
| A | 10 | ccc |
| A | 20 | aaa |
| A | 35 | bbb |
| A | 25 | aaa |
| A | 10 | aaa |
| B | 15 | ccc |
| B | 15 | bbb |
| B | 30 | bbb |
Select sum(colB) as total, ????????? as lable from table1 Group BY colA
Resukt:
| colA | total | lable |
|---|---|---|
| A | 100 | aaa |
| B | 60 | bbb |
thanks!