[Dbix-class] Using Database Functions
matthew couchman (JIC)
matthew.couchman at bbsrc.ac.uk
Mon Sep 14 12:41:28 GMT 2009
Hi,
I'm using DBIx via Catalyst to try and create the underlying SQL query:
SELECT DISTINCT( YEAR( date ) ) FROM gps_location me;
Following the examples at DBIx::Class::Manual::Cookbook it looked like this would do the trick:
$c->stash->{years} = $c->model('DB::GpsLocation')->search(
{},
{
select => [ { YEAR => 'date' } ],
as => [ 'year' ],
distinct => 1,
}
);
However when I run this COUNT() has been added to the query:
SELECT COUNT( DISTINCT( YEAR( date ) ) ) FROM gps_location me;
Where does the COUNT() come from and how do I get rid of it?
Thanks very much,
Matt.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20090914/d15c29d5/attachment.htm
More information about the DBIx-Class
mailing list