Mysql
 sql >> Datenbank >  >> RDS >> Mysql

SELECT mehrere Zeilen, in denen zwei Bedingungen übereinstimmen

Versuchen Sie es,

SELECT userID
FROM tableName
WHERE   (questionID = 14 AND
        answer = 'yes' ) OR
        (questionID = 54 AND
        answer <> 'empty') OR
        (questionid = 100 AND
        answer > 10)
GROUP BY userID
HAVING COUNT(*) = 3

SQLFiddle-Demo