[jifty-devel] Queries using GROUP BY and aggregate functions

Andrew Sterling Hanenkamp sterling at hanenkamp.com
Sat Jul 7 14:35:31 EDT 2007

That's what I thought, which brings me back to: how do I get the
result of an aggregate function like MAX or SUM when I'm not
interested in any individual records--as in, in a similar way to how
we can grab the COUNT of rows?

I can just perform the query using SQL on the DBI for now, but JDBI
could probably add a shortcut for this pretty easily if one doesn't
already exist.

On 7/7/07, Jesse Vincent <jesse at bestpractical.com> wrote:
> On Jul 7, 2007, at 11:07 AM, Andrew Sterling Hanenkamp wrote:
> > On 7/6/07, Jesse Vincent <jesse at bestpractical.com> wrote:
> >> Does this help?
> >
> > In the sense that it tells me I'm sane in doing this, yes. In the
> > sense that it fixes my problem, no.
> >
> > The basic issue remains:
> >
> > FATAL - Can't call method "check_read_rights" on an undefined value at
> > /Library/Perl/5.8.6/Jifty/Collection.pm line 71.
> >
> > It croaks as soon as I call ->next. I should mention that this query
> > will regularly be operating on an empty result and the table is
> > currently empty (after the application is installed it would be an
> > empty result because their just aren't any matching rows). I suppose
> > that it could be barfing because there aren't any records to load just
> > now.
> >
> I suspect that this is because what we're returning _isn't_ an id in
> the id column, it's a count. if you're trying to instantiate record
> objects, you're in trouble.
> _______________________________________________
> jifty-devel mailing list
> jifty-devel at lists.jifty.org
> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel

More information about the jifty-devel mailing list