Answers for "sum of group by in sql"

SQL
1

sql group by sum with condition

SELECT CityID, 
       COUNT(*) NumberOfDogsInThisCity,
       SUM(CASE WHEN DogName = 'Tedy' THEN Wheight ELSE 0 END) WheightOfAllDogWithNameTedy
FROM Dogs
GROUP BY CityID
Posted by: Guest on July-09-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language