[Catalyst] database access through controller in Catalyst
Matt S Trout
dbix-class at trout.me.uk
Wed May 9 16:31:06 GMT 2007
On Wed, May 09, 2007 at 11:41:32PM +1000, Gaurav Talwar wrote:
> Hello all,
>
> i have been trying hard to form a query through my controller to extract records. example:
>
> my $loan_list = $c->model('MyAppDB::TblLoan') ->search
> (
> {userid => $userid},
> {
> select => [ 'userid', 'loanid', { max => 'price' } ],
> group_by => [qw/ loanid /]
> }
> );
>
> i want to extract a loan list. i have userid. but i want to extract loans only with maximum price. So i am just wondering how should i write the maximum condition in the above situation. right now it does nt seem to work.
This is really a DBIx::Class question not a Catalyst question, but the answer
is, I suspect, to add a HAVING clause - see the ResultSet docs for how to
do this (and if you get stuck ask on the dbix-class list for more help :)
--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director Want a managed development or deployment platform?
Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/
More information about the Catalyst
mailing list