Creating a query with AND'S and OR's
Posted: Thu Nov 04, 2010 5:21 pm
Hi,
I have a query that is not working.
query => select * from products where a = '1' AND b = '2' AND c = '3' AND holespacing_decimal IN ('3.00','5.04') OR holespacing_decimal_two IN ('3.00','5.04') OR holespacing_decimal_three IN ('3.00','5.04')
The issue that I am having is that when I use OR's along with AND's everything before the OR's basically gets ignored in the query.
Is there a way to use multiple AND's and multiple OR's in a sql statement. I need to be able to create all of the first statements a = 1, b = 2, and c = 3 and then use the OR's to search these 3 holespacing columns...
Is this possible?
Thanks for you help!
I have a query that is not working.
query => select * from products where a = '1' AND b = '2' AND c = '3' AND holespacing_decimal IN ('3.00','5.04') OR holespacing_decimal_two IN ('3.00','5.04') OR holespacing_decimal_three IN ('3.00','5.04')
The issue that I am having is that when I use OR's along with AND's everything before the OR's basically gets ignored in the query.
Is there a way to use multiple AND's and multiple OR's in a sql statement. I need to be able to create all of the first statements a = 1, b = 2, and c = 3 and then use the OR's to search these 3 holespacing columns...
Is this possible?
Thanks for you help!