I want to get sum of a column of a group (marks), according to another column (is_goodDegree) only contains value 1. and with group by san and temp_key
Check below image;
It should calculate group 2 marks (45+43+47) while it should ignore Group 1.
How can I write a SQL query for this? please advise.
HAVING clause :
SELECT t.san,SUM(t.marks) as sum_marks FROM YourTable t GROUP BY t.san HAVING MIN(t.is_goodDegree) = 1