in reply to SQL Select
When you use the select object method, DBIx::Simple uses SQL::Abstract to create the query and bind arguments.
When SQL::Abstract sees a construct like thing => [...] in a where clause it builds SQL like 'thing = ? OR thing = ? ...' and places the values in the bind arguments (for everything in the arrayref).
It may or may not help you but you could try thing => { -in => [...] } which tells it to build a more concise piece of SQL like 'thing IN (?,?...)' (but still places the values into the bind args).
my @data = $dbh->select( 'table', '*', { ww => { -in => [@ww] }, id => { -in => [@all_ids] }, } )->hashes;
NetWallah has also raised some valid points about GROUP BY and COUNT.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: SQL Select
by Scully4Ever (Novice) on Feb 03, 2016 at 23:40 UTC |