How to use the Date portion of Datatime in a Where clause?
Can someone tell me how to use the date portion of a datetime column in a where clause?
...where date_format(your_datetime_column, '%Y%m%d') = '20030612'
Or, if you mean day, not date:
...where dayofmonth(your_datetime_column) = 12
I tried that but it didn't work. The SQL statement is a join and compares to a variable that is in yyyy/mm/dd format. Here is what I coded
... where data_format(b.date_processed, '%Y/%m/%d') > %currdateminus183
I will try it again and check my logic.
Here's what I ended up doing.
... WHERE b.data-processed > now() - INTERVAL 183 DAY;