sql server - Sum() column X, but add column Y only once
- by Aseem Gautam
My table is like this
A X Y
1 2 3
1 4 3
2 9 1
2 7 1
What I want is to sum X column with Group By A but add Y only once. The values in column Y are always same for a specific A.
When I run this:
SELECT SUM(X) FROM TABLE GROUP BY A
It gives me: 12, 19. But I need 9, 18.
Thanks.