In MySQL, I need to write a query (if possible) that finds all rows of a table where the date_created is the same as last_updated. The rub is that I need to ignore the time. Basically, I’m looking for user rows that were created and activated the same day (we don’t store an activation date). So presumably the dates would be the same but the times may be different.
Share
You could use the DATE() function, which returns only the date portion of a datetime value. This allows you to compare just the date portion of the values:
The timezone may be relevant here. So you may want to cast the datetime values to the user’s timezone prior to using the DATE() function, using CONVERT_TZ().