Re: Idea as to why this query won't work as expected?

From: Date: Tue, 05 Nov 2002 14:15:05 +0000
Subject: Re: Idea as to why this query won't work as expected?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-22988@lists.php.net to get a copy of this message
AND/ OR precedence mistake. Your query will return all the rows for which order_status='Not Shipped' Probably what you want is: select * FROM OrderTable WHERE submitted=1 AND dateinserted>='1036386000' AND dateinserted<='1036502796' AND ( order_status='Shipped' OR order_status='Not Shipped' ) HTH Ignatius J. Reilly ____________________________________________ ----- Original Message ----- From: "Aaron Wolski" <aaronjw@martekbiz.com> To: <php-db@lists.php.net> Sent: Tuesday, November 05, 2002 2:59 PM Subject: [PHP-DB] Idea as to why this query won't work as expected? > Hi All, > > I have a query like: > > select * FROM OrderTable WHERE submitted=1 AND > dateinserted>='1036386000' AND dateinserted<='1036502796' AND > order_status='Shipped' OR order_status='Not Shipped' > > > Now.. if I omit the "AND order_status='Shipped' OR order_status='Not > Shipped'" part the query works fine and only returns 2 results (as > expected). However, with the inclusion of the previous I get all the > results (currently 8) returned. > > It seems to be ignoring everything before "AND order_status='Shipped' OR > order_status='Not Shipped'". > > Any clues? > > Much thanks! > > Aaron >

« previous php.db (#22988) next »