Matthew
Matthew

Reputation: 55

MySQL delete entries in database which are more than a month old

I've been trying in vain to create a script which will read the date and time column (2010-12-16 09:52:37) in this format then delete them.

Can anyone help my column name is called 'generatedAt'.

Upvotes: 0

Views: 3051

Answers (1)

Schenz
Schenz

Reputation: 1113

DELETE FROM [table] WHERE [column] < DATE_SUB(NOW(), INTERVAL 1 MONTH);

Upvotes: 6

Related Questions