[Dbix-class] Group by and more
David Kamholz
davekam at pobox.com
Thu Feb 2 01:00:55 CET 2006
Try something like,
my $rs = DB::Seqtag->search(undef, { select => ['tagid', { count =>
'*' }], as => [qw/tagid count/], group_by => 'tag' });
Then, in the row objects returned by the resultset you can use
get_column to access the second column by whatever name you put in
"as", e.g.:
my $obj = $rs->next;
my $count = $obj->get_column('count');
See docs in DBIx::Class::ResultSet under attributes. Also note that
this *only* works in 0.05. (Where you'll actually want something that
does $schema->resultset('Seqtag') instead of invoking the class
directly...)
Regards,
Dave
More information about the Dbix-class
mailing list