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.

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]

Reply via email to