in reply to generating various sql arguments dynamically, and on crack
If your database supports that or something similar, you can build a clause resembling and table.column in ('PND', 'NEW').select title from node where node_id in (1, 2, 3); +----------+ | title | +----------+ | nodetype | | node | | setting | +----------+ 3 rows in set (0.05 sec)
Something similar to that would do the trick.my %possibleArgs = ( 1 => 'NEW', 4 => 'PND', 9 => 'CLS', ); my @args; for ('col1', 'col2', 'col3') { if (exists($possibleArgs{$_})) { push @args, $possibleArgs{$_}; } } $extraqueryarg = "and table.column in (" . join(',', @args) . ")";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: generating various sql arguments dynamically, and bon crack/b
by mr.dunstan (Monk) on Jun 28, 2001 at 03:12 UTC |