Hi,
I'm having trouble retrieving the columns I think I should have in a
resultset, specifically when using count(*). I've queried the list
archives and the DBIx::Class cookbook, but I can't seem to get this
right.
Here's my code:
my @conds = {
date => { '>' => '2006-06-21 11:59:59', '<'
=> '2006-06-22 11:59:59' },
sensorid => { '>' => '4', '<' => '9' },
};
my @cnt = {
select => [ 'DATE_FORMAT(date,%b)',
'DAYOFMONTH(date)', { count => '*' } ],
as => [ 'month', 'daymonth', 'qcount' ],
};
my @ords = {
order_by => 'sensorid DESC' ,
group_by => 'sensorid'
};
my $rs = $schema->resultset('Tblsensorlog')->search(@conds,@cnt,@ords);
my $choice = $rs->first;
$c->stash->{st_record} = $choice->qcount;
The last line doesn't work. I get the following message:
Can't locate object method "qcount" via package
"vieDB::Model::SensorLogDB::Tblsensorlog"
I can change "qcount" in that last line to the name of a field in the
table and access that field just fine. But trying any of the fields I
named myself (month, daymonth, qcount) gives me that error.
Any ideas?
thanks,
Sarah
_______________________________________________
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]/