Is there something in MySQL like IN but which uses AND instead of OR?
Posted
by Skatox
on Stack Overflow
See other posts from Stack Overflow
or by Skatox
Published on 2010-05-18T19:24:08Z
Indexed on
2010/05/18
19:40 UTC
Read the original article
Hit count: 83
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.
© Stack Overflow or respective owner