Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Ionitor's scratchpad

by Ionitor (Scribe)
on Nov 29, 2004 at 16:48 UTC ( #410965=scratchpad: print w/ replies, xml ) Need Help??

Using proper syntax

$result_set->search( {}, { select => [ 'winner', \'COUNT(*) AS votes', ], as => [ 'winner', 'votes', ], group_by => [ 'winner', ], having => { 'votes' => 6 }, } );
Produces DBIC_TRACE of:
SELECT winner, COUNT(*) AS votes FROM winners GROUP BY winner HAVING ( votes = ? ): '6'

Short-circuiting placeholders

$result_set->search( {}, { select => [ 'winner', \'COUNT(*) AS votes', ], as => [ 'winner', 'votes', ], group_by => [ 'winner', ], having => 'votes = 6', } );
DBIC_TRACE shows:
SELECT winner, COUNT(*) AS votes FROM winners me GROUP BY winner HAVING ( votes = 6 ):

First fails to return a valid result, second works fine.

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (13)
As of 2014-10-23 15:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (125 votes), past polls