G
Guest
I'm trying to create a query using SQL and keep getting syntax errors, can
anyong point me in the correct direction? Here is my code:
SELECT [member_id1] & [member_id2] AS [key],
SUM(CASE WHEN test.category_nbr = 1 THEN test.SalesDollars ELSE 0 END)
AS SalesDollarsCat1 ,
FROM test
GROUP BY [key];
So, basically I have a table called "test", and I want to sum up the Sales
Dollars for each separate category_nbr, and group by key. I have around 100
category numbers so once I get the first line working I can just copy paste
for all other's.
Thanks,
anyong point me in the correct direction? Here is my code:
SELECT [member_id1] & [member_id2] AS [key],
SUM(CASE WHEN test.category_nbr = 1 THEN test.SalesDollars ELSE 0 END)
AS SalesDollarsCat1 ,
FROM test
GROUP BY [key];
So, basically I have a table called "test", and I want to sum up the Sales
Dollars for each separate category_nbr, and group by key. I have around 100
category numbers so once I get the first line working I can just copy paste
for all other's.
Thanks,