B
B
Breezer952015-10-21 10:31:02
MySQL
Breezer95, 2015-10-21 10:31:02

DELETE DATE_ADD Mysql query how to write correctly?

I need to make sure that messages that come in the form msg are deleted after 30 minutes from the last message sent, d is DATETIME.
mysql_query("DELETE FROM msg WHERE d <= DATE_ADD(d,INTERVAL -30 MINUTE)"); // Tried something x(
Thanks for the help!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daniil Kostin, 2015-10-21
@Breezer95

DELETE FROM msg WHERE d <= DATE_ADD(SELECT MAX(d) FROM msg,INTERVAL -30 MINUTE)

try like this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question