[Dbix-class] DISTINCT group by sql

Matt S Trout dbix-class at trout.me.uk
Fri Jun 30 19:32:43 CEST 2006

Chris Lock wrote:
> I need to group by both to arrange the data how I want it if I only
> groiup by channel then I get 13 results, what I need is the channels
> grouped with the days because each datetime has multiple entries, each
> one could be a channel
> I could attach the first 50 entries in the DB to give you an idea of
> what the data is like if that would help.  (Its really difficult to
> explain data in text)

Then you're screwed. COUNT doesn't (AFAIK) generally work like that so we 
can't change the count SQL DBIC emits and evidently your DB can't handle 
multiple arguments to DISTINCT.

The only truly general way to do COUNT for an aggregated statement is with a 
subselect, and we won't have subselect support until 08.

For the moment about the only workaround I can give you is "don't try and call 
->count on a resultset like that one", sorry.

      Matt S Trout       Offering custom development, consultancy and support
   Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +

More information about the Dbix-class mailing list