I wanted to do something similar I was told it cant be done (as yet) because of the way DISTINCT works. But he also tells me that sub-selects will be coming in 08 which may fix things.
------------------------------ Message: 5 Date: Fri, 07 Jul 2006 09:03:10 +0000 From: fayland <[EMAIL PROTECTED]> Subject: [Dbix-class] help on group_by and select as? To: [email protected] Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=UTF-8; format=flowed mmm, I have some code like this: my $it = $dbic_data->resultset('table_name')->search( { want => $want, }, { select => [ 'a', 'b', { max => 'c' } ], as => [ 'a', 'b', 'max_cid' ], group_by => [qw/ a b /], order_by => 'max_cid DESC', page => 1, rows => 10 } ); debug info shows: DBIx::Class::ResultSet::all(): Error executing 'SELECT a, b, MAX( c ) FROM table_name me WHERE ( want = ? ) GROUP BY a, b ORDER BY max_cid DESC LIMIT 10': Unknown column 'max_cid' in 'order clause' at seems as => is not working? my code is anything wrong? When I comment the "order_by => 'max_cid DESC', it complains like this: | DBIx::Class::ResultSet::pager(): Error executing 'SELECT COUNT( DISTINCT( a, b ) ) FROM table_name me WHERE ( want = ? )': Operand should contain 1 column(s) at I don't know why? mm, I tried |0.06999_05 <http://search.cpan.org/%7Ejguenther/DBIx-Class-0.06999_05/> and 0.06003, both no luck. Thanks in advanced. -- Fayland Lam // http://www.fayland.org/ _______________________________________________ List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class Wiki: http://dbix-class.shadowcatsystems.co.uk/ IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/ Searchable Archive: http://www.mail-archive.com/[email protected]/
