Archive data (table rows) mysql

201 Views Asked by At

I have data in a table row associated with a user. I'd like to archive the old data based on year. However, the data is associated with a count for the user, i.e. each user has purchased a "post" and each "post" is a row in the table. If I just delete (drop the row) the "post" my software will automatically adjust the number of available "posts" back to the user.

I'd like to be able to archive or delete old "posts" in the database, without crediting the use of the post back to the user. The php is something like: user1 has 30 credited "posts" of which 15 have been used therefore 15 "posts" remain. Dropping the row manually results in: user1 has 14 "posts" used and 16 "posts" remaining.

I'd like to clean out the old "posts" about 80,000 of them.

Is there a standard method of doing something like this?

0

There are 0 best solutions below