mercredi 31 décembre 2014

Avoiding multiple `or` statements


I have the following oracle SQL and its works and all but it's quite ugly with all of the ors. Is there a more concise way of doing this?



SELECT * FROM foobar WHERE
(t1.SUBJECT ='STAT' and t1.TERM ='111') or
( t1.SUBJECT ='STAT' and t1.TERM ='222') or
( t1.SUBJECT ='ENGLISH' and t1.TERM ='555') or
( t1.SUBJECT ='COMM' and t1.TERM ='444') or
( t1.SUBJECT ='COMM' and t1.TERM ='333') or
( t1.SUBJECT ='STAT' and t1.TERM ='666')
...




Aucun commentaire:

Enregistrer un commentaire