http://www.perlmonks.org?node_id=1103435


in reply to Re^2: Place holders in SQL query
in thread Place holders in SQL query

my @states = map {$_->{state}} @$citydata; . . exec_select(sql, @states);

Replies are listed 'Best First'.
Re^4: Place holders in SQL query
by Anonymous Monk on Oct 10, 2014 at 17:43 UTC
    It worked!
    my $citydata = $dbh->exec_select( "select city,state from mytable whe +re city = ?", $city ); my @states = map {$_->{state}} @$citydata; my $statedata = join ' OR ', map { "state = ?" } @$citydata; my $codedata = $dbh->exec_select( "select code from othertable where +(year=2014 and ($statedata)), @states );

    Thanks for the help!