in reply to Re^4: Query using more than one array!
in thread Query using more than one array!
use strict; use List::MoreUtils qw/zip/; use DBI; my @reg_num = qw/12345 98564 33234 112345 87564 2345678 938566 1234486 + 223456 123488/; my @month = qw/03 01 01 10 05 11 03 05 02 09/; my $sql_part = join ' or ', map {'(reg_num = ? AND month = ?)'} 1 .. @ +reg_num; my $dbh = DBI->connect("DBI:ODBC:$myserver",$u, $p,); my $sth = $dbh->prepare( "SELECT name, last_name, reg_num, month, year FROM members WHERE $sql_part AND year='2009"); $sth->execute(zip @reg_num, @month);
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Query using more than one array!
by Anonymous Monk on May 14, 2009 at 14:14 UTC | |
by CountZero (Bishop) on May 14, 2009 at 16:10 UTC |