in reply to Re: Deleting Old MySql Records With PERL
in thread Deleting Old MySql Records With PERL

I tried the suggested code in my program and it didn't work. I have changed the Date column name to Posted and am using this code

my $dbh = DBI->connect('dbi:mysql:owner_db','searcher','searcherpasswd +') or die "Connection Error: $DBI::errstr\n"; $sth = $dbh->prepare ("DELETE FROM my table WHERE POSTED < DATE_SUB(NO +W(), INTERVAL 30 DAY)"); $sth->execute ();

I have also tried the same code with the mysql client. In both cases the 30 DAY interval is ignored and everything is deleted.

Any suggestions?

Replies are listed 'Best First'.
Re^3: Deleting Old MySql Records With PERL
by poj (Abbot) on Jul 14, 2016 at 19:22 UTC

    What is the data type of the Posted field ?

    poj