Hi,
I have a query that I need help with. I am having trouble with getting a nested query to react to the where clause of the whole query.
Example 1:
SELECT Achievement_Level, SUM(Rec_Count), (SELECT SUM(Sum_Count) FROM Temp)
FROM Temp
GROUP BY Achievement_Level
Results 1:
Advanced 5 22
Mastery 7 22
Basic 10 22
What I want is the last column (22) to dynamically change based on my filter.
Example 2:
SELECT Achievement_Level, SUM(Rec_Count), (SELECT SUM(Sum_Count) FROM Temp)
FROM Temp
WHERE Achievement_Level IN ('Advanced','Mastery')
GROUP BY Achievement_Level
Results 2:
Advanced 5 22
Mastery 7 22
I need this to sum to 12, but based on the query, it will still provide a result of 22.
Please let me know if you can help me with this.
Thanks