R
Rebecca
Having trouble with HAVING clause.
Say my table shows families with one row for each kid, labeling that kid's
gender
So Jones family has 2 girls, 1 boy; Smith family has 2 boys, etc.
Jones / girl
Jones / girl
Jones /boy
Smith /boy
Smith / boy
Sanchez / girl
Sanchez /girl
Chang / boy
I want to ONLY get the families that DON'T have ANY girls. So my query
result should be Smith & Chang.
I did: HAVING (gender <>"girl")
But get an error message about it not being part of aggregate function.
Is there a way to make this work?
Note: I already did the query a different way, making girl=1 and boy =0,
instead of girl/boy word labels, and then just selected sum <1. (i.e., no
girls) But I still want to figure out how to use the HAVING clause in this
instance, if it's possible.
Thanks.
Say my table shows families with one row for each kid, labeling that kid's
gender
So Jones family has 2 girls, 1 boy; Smith family has 2 boys, etc.
Jones / girl
Jones / girl
Jones /boy
Smith /boy
Smith / boy
Sanchez / girl
Sanchez /girl
Chang / boy
I want to ONLY get the families that DON'T have ANY girls. So my query
result should be Smith & Chang.
I did: HAVING (gender <>"girl")
But get an error message about it not being part of aggregate function.
Is there a way to make this work?
Note: I already did the query a different way, making girl=1 and boy =0,
instead of girl/boy word labels, and then just selected sum <1. (i.e., no
girls) But I still want to figure out how to use the HAVING clause in this
instance, if it's possible.
Thanks.