Hi all - not a SQL expert by any stretch of the imagination although I have moved on from GUI generated SQL to writing my own. I don't know a huge amount about query optimising but myself and a colleague were just discussing whether it was better / faster to use IN or a set of multiple OR statements when limiting data based on a set of values e.g.
SELECT blah FROM Table WHERE SomeCode IN ('a','b','c')
or
SELECT blah FROM Table WHERE (SomeCode = 'a' OR SomeCode = 'b' OR SomeCode = 'c')
Any thoughts? Apologies if this is either pointless or obvious - I did do a search of the forum but OR tends to bring up a lot of results
Rgds, Geoff
We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.
Please read FAQ222-2244 before you ask a question
SELECT blah FROM Table WHERE SomeCode IN ('a','b','c')
or
SELECT blah FROM Table WHERE (SomeCode = 'a' OR SomeCode = 'b' OR SomeCode = 'c')
Any thoughts? Apologies if this is either pointless or obvious - I did do a search of the forum but OR tends to bring up a lot of results
Rgds, Geoff
We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.
Please read FAQ222-2244 before you ask a question