How do I do this in MySQL?
SELECT * FROM MyTable WHERE MyDateCol < TODAY()
I googled a lot on the subject and didn’t really find anything except “look in the MySQL date ref” which does not explain the above easily enough.
I know I can do the following which is kinda indirect:
SELECT * FROM MyTable WHERE MyDateCol BETWEEN (0000-00-00) AND TODAY()
In MySQL, you have the
curdate()funciton, that will get you the date of today.So, something like this should do :
Quoting the manual’s page of that function :
And if you want to compare to the current time (and not only day), you can use the
now()function :