I am beginner in SQL Server, I want to write the following query in T-SQL, and I can't find out how to do it
SELECT
SUM(PROSPECTS),
MARQUE,
LANGUAGE
FROM
USERS
CASE Marque IN (0, 16, 30, 36) THEN Group BY MARQUE ELSE Group By Language
Can someone help me please?
CodePudding user response:
Close...
group by
CASE Marque IN (0, 16, 30, 36) THEN MARQUE ELSE Language END
But also need to apply same context at the top
SELECT
SUM(PROSPECTS),
CASE Marque IN (0, 16, 30, 36) THEN MARQUE ELSE Language END MarqLang
FROM
USERS
group by
CASE Marque IN (0, 16, 30, 36) THEN MARQUE ELSE Language END