I've got a table with two datetime fields (startDate and endDate).
I want to select rows where today's date lies between startDate and endDate.
I have this currently:
SELECT p.positionID, p.positionName, s.name, p.description, p.startDate, p.endDate
FROM position as p INNER JOIN service as s ON p.serviceID=s.serviceID
WHERE p.endDate < 2010-06-01 05:06:06 AND p.startDate < 2010-06-01 05:06:06
ORDER BY s.name, p.positionName
That date/time is created with PHP date().
Error:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '05:06:06 AND p.startDate < 2010-06-01 05:06:06 ORDER BY s.name, p.positionName ' at line 3
If I change the WHERE to something trivial, it works fine.
Searching hasn't gotten me very far sadly, so I come to you guys for help.