var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
someone can tell me if
SELECT ... WHERE myField IN (1,2,3)
is more efficient than
SELECT ... WHERE (myField = 1) OR (myField = 2) OR (myField = 3)
thanks in advance
depends on your database, but in general, they will be exactly the same
the IN is easier to write, though, easier to read, and easier to maintain, isn't it
rudy.ca | @rudydotca
Buy my SitePoint book: Simply SQL
I guess the query will run better if there's an index on 'myfield' column; IN compared to multiple ORs doesn't improve execution at all (at least, that's what a quick example on Oracle database (its explain plan and statistics) showed).
Log in with your username and password
Forgot your password?
Subscribe to dBforums Brief to receive special offers from dBforums partners and sponsors