From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
---|---|
To: | Jon Lapham <lapham(at)jandr(dot)org> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Group By and wildcards... |
Date: | 2005-02-19 17:04:42 |
Message-ID: | 20050219170442.GA15226@wolff.to |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Sat, Feb 19, 2005 at 12:07:12 -0200,
Jon Lapham <lapham(at)jandr(dot)org> wrote:
> When using queries with aggregate functions, is there any way to not
> have to have to explicitly write all the columns names after the GROUP
> BY ? I would like to use a wildcard "*".
>
> Imagine tables a, b, c, d each with hundreds of columns.
>
> As an example, I would like to write:
>
> SELECT a.*, b.*, c.*, SUM(d.blah)
> FROM a, b, c, d
> WHERE <some join conditions>
> GROUP BY a.*, b.*, c.*
>
> Instead of having to expand the "GROUP BY a.*, b.*, c.*" using the
> explicit column names of all the column in a, b, and c.
>
> This becomes a maintenance nightmare as you add/drop column in these
> tables...
>
> Thanks for any advice on how to handle this,
> -Jon
Don't those tables have primary keys? Grouping by the primay key of each
table will produce the same result set as grouping by all of the columns.
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Verite | 2005-02-19 17:10:12 | Re: I'm newbie |
Previous Message | charlie clark | 2005-02-19 17:04:32 | How do I change sort order behavious with nulls |