I’ve been trying to do is for ages but can’t seem to do it, it’s the follwing:
Select count of values in column x where columnfoo = y
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use
CASEexpressions within aggregate functions to only aggregate based on a condition:If columnfoo =
y, then factor the row into the count, otherwise, don’t add to the count.This avoids having to filter out records in your
WHEREclause in case you also want to work with records where columnfoo is differenty.Example: You can count based on different conditions at the same time: