Quote:
|
Originally Posted by impactorange
SELECT * FROM Orders WHERE stationid = '26' AND productid = '1' AND ((now() BETWEEN startdate AND enddate) OR ('11' BETWEEN MONTH(startdate) AND MONTH(enddate))) ORDER BY productid
In this particular case, month = 11 (Nov) but it still retrieves orders with a startdate = 20050901000000 (Sept) and enddate = 20051005000000 (Oct).
|
If NOW() returns the timestamp of now (around 2005-09-28), your
'now() BETWEEN startdate AND enddate' subclause, which is
ORed with your month selection logic, is true.
--
felix