Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
# The first SQL query to get the state value<br> my $citydata = $dbh->exec_select( "select city,state from mytable wher +e city = ?", $city ); # This one gets me all the values found for state my $statedata = join ' OR ', map { "state = $_->{ state}" } @$citydata +; # Now $statedate gets this: “state = NH OR state = NY”. # I would like to add place holders and pass these values into the sec +ond query # To read like “state = ? OR state ?” my $codedata = $dbh->exec_select( "select code from othertable where + (year=2014 and ($statedata)), $citydata->{state},$citydata->{state} + );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Place holders in SQL query
by poj (Abbot) on Oct 10, 2014 at 16:07 UTC | |
|
Re: Place holders in SQL query
by McA (Priest) on Oct 10, 2014 at 16:26 UTC | |
|
Re: Place holders in SQL query
by mje (Curate) on Oct 10, 2014 at 15:03 UTC | |
by Anonymous Monk on Oct 10, 2014 at 15:14 UTC | |
by mje (Curate) on Oct 10, 2014 at 15:41 UTC | |
by Anonymous Monk on Oct 10, 2014 at 17:43 UTC | |
|
Re: Placeholders in SQL query
by erix (Prior) on Oct 10, 2014 at 15:17 UTC | |
by hippo (Archbishop) on Oct 10, 2014 at 16:09 UTC | |
by Anonymous Monk on Oct 10, 2014 at 15:31 UTC | |
by Anonymous Monk on Oct 10, 2014 at 15:28 UTC | |
by Anonymous Monk on Oct 11, 2014 at 03:21 UTC |