Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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 meditating upon the Monastery: (8)
As of 2014-08-23 12:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (173 votes), past polls