Answers for "sum and group by 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
1

sql sum and other fields

SELECT sum(a) as car,b,c FROM toys 
GROUP BY b, c
Posted by: Guest on October-25-2020

Code answers related to "SQL"

Browse Popular Code Answers by Language