Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: Deleting Old MySql Records With PERL

by Milti (Beadle)
on Jul 14, 2016 at 16:00 UTC ( [id://1167791]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1167791]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-09-07 17:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.