Choosing between a union and a boolean condition

Posted by bread on Stack Overflow See other posts from Stack Overflow or by bread
Published on 2010-06-09T08:57:20Z Indexed on 2010/06/09 9:02 UTC
Read the original article Hit count: 225

Filed under:

Does this require a UNION?

SELECT vend_id, prod_id, prod_price
FROM products
WHERE prod_price <= 5
UNION
SELECT vend_id, prod_id, prod_price
FROM products
WHERE vend_id IN (1001,1002);

Or is it the same if you do it this way?

SELECT vend_id, prod_id, prod_price
FROM products
WHERE prod_price <= 5
OR vend_id IN (1001,1002);

© Stack Overflow or respective owner

Related posts about sql