Deleting records before a certain date

Hard worker picture Hard worker · Dec 2, 2011 · Viewed 145.4k times · Source

How would I go about deleting all records from a MySQL table from before a certain date, where the date column is in DATETIME format?

An example datetime is 2011-09-21 08:21:22.

Answer

Michael Mior picture Michael Mior · Dec 2, 2011
DELETE FROM table WHERE date < '2011-09-21 08:21:22';