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
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
sql sum and other fields
SELECT sum(a) as car,b,c FROM toys
GROUP BY b, c
sum with group by in sql server
SELECT cust_city, SUM (opening_amt + receive_amt)
FROM customer
GROUP BY cust_city;
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us