tic
tic

Reputation: 4199

and/or conditions in a SQL query

I have to select all the records where FIELD1 is value11 or value12 and FIELD2 is value21, value22, value23, ... or value29. All 2*9=18 pairs of admissible values for FIELD1 and FIELD2 are possible. Which is the most compact form to write down my SQL query?

Upvotes: 0

Views: 268

Answers (1)

Arjan
Arjan

Reputation: 23569

where field1 in (value11, value12)
and field2 in (value21, value22, value23, ..., value29)

(Where you need to replace the dots with all value24 and so on.)

Upvotes: 3

Related Questions