MySQL Forums
Forum List  »  Perl

Using @variables
Posted by: Joris Spekreijse
Date: June 16, 2007 05:22PM

Hello.

I want to use the @variables in my perl script. The only problem is that the query runs smoothly in MySQL but Perl just struggles with the query.

As you can see I want to use @datum to avoid unnecessary CPU-load to calculate the current date.

my $db = DBI->connect("DBI:mysql:$dbname:$dbhost",$dbuser, $dbpass) || die (DBI->errstr);
$db->do("INSERT INTO log_tekorten
SELECT \@datum := DATE(NOW()), COUNT(p.SFC)
FROM processen p
WHERE p.bewerking = 100
AND p.p_datum = \@datum
AND p.klaar < 0
")|| die (DBI->errstr);
$db->disconnect();

What am I overlooking?



Edited 1 time(s). Last edit at 06/16/2007 05:24PM by Joris Spekreijse.

Options: ReplyQuote


Subject
Written By
Posted
Using @variables
June 16, 2007 05:22PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.