I have the following query to retrieve customers who answer YES to a particular question "OR" NO to another question.
SELECT customers.id
FROM customers, responses
WHERE (
(
responses.question_id = 5
AND responses.value_enum = 'YES'
)
OR (
responses.question_id = 9
AND responses.value_enum = 'NO'
)
)
GROUP BY customers.id
Which works fine. However I wish to change the query to retrieve customers who answer YES to a particular question "AND" answer NO to another question.
Any ideas on how I can achieve this?
PS - The responses above table is in an EAV format ie. a row represents an attribute rather than a column.