Is there something in MySQL like IN but which uses AND instead of OR?
- by Skatox
I need a SQL statement to retrieve records where it key (or any column) is in a associate table, for example:
documentId termId
4 1
4 2
3 3
5 1
This:
SELECT documentId
FROM table
WHERE termId IN (1,2,3)
...will retrieve any documentid value where the termid value is 1 or 2 or 3.
Is there something like this but return documentid values where the termid values are 1 and 2 and 3? Like an IN but with AND.