I tried what you said and also what manual says, but it is not working....
my tries:HAVING => { count('t_id') => $tCount}
HAVING => {'COUNT_t_id' => {'=', $tCount } }HAVING => { count('t_id') => {'=',
$tCount } }
I get err.
the manual says:
having
- Value: $condition
The HAVING operator specifies a secondary condition applied to the set after
the grouping calculations have been done. In other words it is a constraint
just like "where" (and accepting the same SQL::Abstract syntax) applied to the
data as it exists after GROUP BY has taken place. Specifying "having" without
"group_by" is a logical mistake, and a fatal error on most RDBMS engines.E.g.
having => { 'count_employee' => { '>=', 100 } }or with an in-place function in
which case literal SQL is required: having => \[ 'count(employee) >= ?', 100 ]
On Saturday, September 3, 2016 12:51 AM, Ron Savage <[email protected]>
wrote:
Hi Rajeev
On 03/09/16 11:38, Rajeev Prasad via dbi-users wrote:
> DBIx error in webserver log:
>
> [cgi:error] [pid 29640] ... AH01215: Can't locate object method "HAVING"
> via package "COUNT" (perhaps you forgot to load "COUNT"?)
>
>
> the query:
>
> my $obj_rs = $schema->resultset('itemList')->serach(
> { t_id => { -in => [ $tStr ] }},
> {
> group_by => [ qw(i_id) ],
> HAVING COUNT('t_id') = $tCount
What is this? The syntax you have used is simple not Perl.
I did not check the manual, but try (wild guess):
"having count('t_id')" => $tCount,
> }
> );
>
>
> currently database has no records which match the query. but i was not
> expecting such an error.
>
> what is wrong in my statement?
>
> thank you.
> Rajeev
--
Ron Savage - savage.net.au