0

I have a database in my mysql. Inside are tables with each name an email address. Each table has the same structure. So something like

data (database)
    x@x.com (table name)
        [column 1] [column 2] ... (column names)

I'd like to create an event that removes entries after 24 hours. Unfortunately I'm unable to do something like

DELETE FROM data.* WHERE created < DATE_SUB(NOW(), INTERVAL 1 DAY)

It looks like I'm unable to use the wildcard. What's the easiest way to accomplish this?

Edit:

Truncating all tables is not the proper solution I'm looking for as I'm not looking to purge all data in a table, but rather select data based on a condition.

I found the easiest solution would be to just write a script like Nick mentioned to select the data I need from information_schema and delete the entries I need from each table based on the condition I need.

thecodingmate
  • 331
  • 6
  • 16

0 Answers0