in reply to SQL queries using dynamic array
my @values = qw/Otago Auckland Nortland/; #Quote Values to be safe my $values = join("," ,map { $dbh->quote($_) } @values ); my $statement = " SELECT c_email, c_first, c_last FROM tblClient, tblGroup, tblRegion WHERE tblGroup.g_name = 'motel' AND tblRegion.r_name IN ( $values )"; my $sth = $dbh->prepare($statement); $sth->execute();
HTH
-enlil
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: SQL queries using dynamic array
by jhourcle (Prior) on Aug 04, 2005 at 01:40 UTC |