Could this be correct or is there a more efficient way of doing it?
#...more code above, all variable previously declared and strict is al
+so been used.
push @all_names, $names;
push @email, $email;
push @local, $local;
push @year, $year;
} #end of foreach.
#Getting data
my $dbh = DBI->connect("DBI:ODBC:$myserver",$u, $p, { RaiseError => 1
+});
my $vals =
join(","
,map { $dbh->quote($_) } @all_names
);
my $year_val =
join(","
,map { $dbh->quote($_) } @year
);
my $email_val =
join(","
,map { $dbh->quote($_) } @email
);
my $local_val =
join(","
,map { $dbh->quote($_) } @local
);
my $sql = "SELECT DISTINCT
name, email, addr, location
FROM my_users
WHERE year IN ($year_val) /* need all the v
+alues from @year */
AND email IN ($email_val) /* need all the v
+alues from @email */
AND location IN ($local) /* need all the va
+lues from @local */
AND name IN ($vals)
";
|