Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DBI syntax

Status
Not open for further replies.

user2base

Technical User
Oct 16, 2002
29
0
0
GB
I want to delete entries in a mysql table for which timestamp is older than 1 Hour. The mysql syntax is:

DELETE from table WHERE t < DATE_SUB(NOW(), INTERVAL 1 HOUR);

This works fine but I can't get it running through a perl DBI command. The following for instance does not work:

$dbh->do(&quot;DELETE from table WHERE t < DATE_SUB(NOW(), INTERVAL 1 HOUR)&quot;);

Any idea ?
 
#This should work fine as long as you are connected to the database.

$sth=$dbh->prepare (qq{
DELETE from table WHERE t < DATE_SUB(NOW(), INTERVAL 1 HOUR)
} );
$sth->execute ();
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top