Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
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?
[atcroft]: Discipulus: I looked back at your note about my Padre question from a while back, and it made me look again... as a result, I found what I was missing and was able to make the change. Thank you!

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2018-02-24 20:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (311 votes). Check out past polls.

    Notices?