in reply to how do i construct a sql select statement, where i want to get the where clauses out of an array
If there ARE too many ids, then you're stuck with:$where_clause = 'where id in ('.join(",",("?") x @id).')'; $sql .= $where_clause; my $sth = $dbh->prepare($sql); $sth->execute(@id);
How many is TOO many? Dunno. Depends. 256 or so?$sql .= 'where id = ?'; my $sth = $dbh->prepare($sql); for my $id (@id) { $sth->execute($id); ... }
Update: I like tilly's temp table idea. I've actually done that in some cases.
|
|---|