>You are correct... my apologies, I was thinking in VB where I built a handler to let me sent multiple sql statements in one chunk and where the '@' doesn't matter.
BB This Works as a test... my $getbigage = $dbh->prepare( "SELECT \@maxage:=max(age) from contacts"); my $getbigage1 = $dbh->prepare( "SELECT * FROM contacts WHERE age=\@maxage"); $getbigage->execute(); $getbigage1->execute(); while(my @h = $getbigage->fetchrow_array()){ print "The max age is ==> $h[0]\n"; #see the answer } my @list = (); my $target = undef; while(my @h = $getbigage1->fetchrow_array()){ $fname = $h[0]; $lname = $h[1]; $age = $h[2]; print "The contact(s) I was looking for ==> $fname, $lname, $age\n"; push(@list, [$h[0],$h[1],$h[2]]); } -----Original Message----- From: Paul DuBois [mailto:[EMAIL PROTECTED]] Sent: Monday, January 28, 2002 11:28 AM To: [EMAIL PROTECTED]; Richard Morton; DL Neil; [EMAIL PROTECTED] Subject: RE: Selecting the row with largest number in a column >Perl Example: > >my $getbigage = $dbh->prepare( > "SELECT @maxage:=max(age) from contacts;". > "SELECT * FROM contacts WHERE age=@maxage;"; I don't believe this will work. @ in double-quoted Perl strings must be escaped with a backslash. More important, you cannot issue multiple queries at a time. In the case above, the MySQL will return an error indicating a syntax error at the semicolon that occurs within the string. --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php