I've got a table that stores survey question information and I'm looking to find out a count based on gender, race, etc My issue is that I have to reference the same columns multiple times in the where clause and I'm not sure the best way to do that.
I need to know the count all of the people that answered yes to survey question 24 AND ALSO yes to questions 4 or 16 or 24. I have tried messing with Or statements and IN statements but both aren't working for me. I was looking at using a case statement in the WHERE clause but not sure what that would need to look like. Any help or advice would be most appreciated!!
with TheTotal as (select count(table.name_id)over (partition by table.other_id) as blah where sex='M' AND table.date between '2019-01-01' and '2019-09-30' AND (table.jq_nbr=35 AND table.answer='Y') AND ( (jq_nbr=4 and answer='Y') OR (jq_nbr=16 and answer='Y') OR (jq_nbr=24 and answer='Y') )