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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The or part should be in parens. Your bascialy saying grab everything
that has order_status='Shipped' and your date requirements, OR
everything where order_status is equal to 'Not Shipped'...

-- Josh

-----Original Message-----
From: Aaron Wolski [mailto:aaronjw@martekbiz.com] 
Sent: Tuesday, November 05, 2002 9:00 AM
To: php-db@lists.php.net
Subject:  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


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux