SQL Query

Hi Everyone,

a good day to all of you. I am a newbie in SQL queries and I would like to ask a question in an existing query I have.



SELECT
SUM (SPEND) SPEND1,
FROM
TIME
WHERE LTM = 1

Now I need to modify this query to add another column called SPEND2 but this time, it's where clause shouldn't be LTM=1, it should be L4M = 1

I can't do LTM=1 and L4M = 1 because the where clause will apply to both SPEND1 and SPEND2.
Spend1 where should be LTM=1 and Spend2 should be L4M=1

they should be in the same query.

I would like to do this :

Select
Sum (Spend) as Spend1 where LTM = 1
Sum (Spend) as Spend2 where L4M = 1

I want to thank you for your advance help and do let me know if my question is confusing and I will gladly and immidiately clarify.

Comments

Sign In or Register to comment.