Re: Group By and wildcards... - Mailing list pgsql-general

From Bruno Wolff III
Subject Re: Group By and wildcards...
Date
Msg-id 20050219192033.GA24244@wolff.to
Whole thread Raw
In response to Group By and wildcards...  (Jon Lapham <lapham@jandr.org>)
List pgsql-general
On Sat, Feb 19, 2005 at 14:02:34 -0500,
  Oisin Glynn <me@oisinglynn.com> wrote:
>
> But the where clause defines the result of the aggregate function (in this
> case the SUM)?

Not really.

> Is the only reason for needing the GROUP BY CLAUSE is because the aggregate
> function demands it?

Note that there is also a join to a table d. So that values in d are
being summed up based on some connection from d to the other 3 tables.

> If so could something like the following work where we pass the where clause
> conditions into the function and it performs the aggregate function and
> returns..  I am guessing this would be extremely inefficient?
>
> select A.*,B.*,C.*,my_cheating_sum(a.id,b.id,c.id) from a,b,c,
> where some conditions;

If that function did a select from d, you could make this work, but it
would likely be much slower than doing it in one SQL statement.

pgsql-general by date:

Previous
From: Greg Stark
Date:
Subject: Re: Group By and wildcards...
Next
From: "Reuben D. Budiardja"
Date:
Subject: Re: Client lib v. 7.3 to access 8.0 db server. Compatible ?