in reply to Re^2: SQL Select
in thread SQL Select
If the ids are in another table (eg table_id) then you could use a join (inner) to filter the results. Here's an example using SQL::Abstract::More
poj#!perl use strict; use DBIx::Simple; use SQL::Abstract::More; my $dbh = '....'; # connect $dbh->abstract = SQL::Abstract::More->new(); my @ww = qw/a b c/; my @data = $dbh->select( -from => [ -join => qw/table id=id table_id/], -columns => ['part'], -where => { ww => {-in => [@ww] }, part => {-not_like => '0000000%'} }, -union => [ -columns => ['n'], -where => { ww => {-in => [@ww] }, part => {-like => '0000000%'} } ], -group_by => ['part'], )->flat; print 'The uin count is '.scalar @data."\n";
|
|---|