please consider data:
Id Group Value
-----------------------------------
1 1 10
2 1 12
3 1 10
4 2 90
5 2 10
6 3 30
7 4 12
8 4 11
9 5 10
10 5 11
I want to do Group By on this data as 1,2,3 place in one group and 4,5 place in another group. How I can do this with SQL Server?
thanks
Edit 1)
I want this result:
Groups Count
-----------------------------------------
Group for 1,2,3 6
Group for 4,5 4
I’m using
outer applyso you will not duplicate your code to groupyou can also use subquery