List:General Discussion« Previous MessageNext Message »
From:(Hal Date:January 26 2012 5:45pm
Subject:Re: Script for cleaning data on a regular basis
View as plain text  
>>>> 20120126 10:34 AM +0200, a bv >>>>
Database contains
tables (structures?) which gets montly data , and these tables are
named as

name1_name2_ yearmonth . I only want to have the whole database system
for last 2 years, and automaticly clean the data which became more
than 2 years old , so i need a script for this (shell, php etc) . Can
you please help me for this script ? and also which mysql command must
be used drop, trunk? 
<<<<<<<<
You can, if you are careful, write an SQL procedure for dropping the appropriate tables.
Since MySQL has no table variables, if you do this you will need PREPARE.

Therefore, it well may be easier to do it all in PHP, since therewith you can construct
statements. The statement "SHOW TABLES" is also a reference to table
INFORMATION_SCHEMA.TABLES; maybe you can use "SHOW TABLES" for a SELECT statement in PHP;
if not, try INFORMATION_SCHEMA.TABLES for their names.

Thread
Script for cleaning data on a regular basisa bv26 Jan
  • Re: Script for cleaning data on a regular basishsv26 Jan
    • Re: Script for cleaning data on a regular basisJohan De Meersman27 Jan
      • Re: Script for cleaning data on a regular basisKaren Abgarian27 Jan
    • Re: Script for cleaning data on a regular basiswalter harms27 Jan