Group By and wildcards...

From: Jon Lapham <lapham(at)jandr(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Group By and wildcards...
Date: 2005-02-19 14:07:12
Message-ID: 42174810.6050709@jandr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

PS: I'm using postgresql v7.4.x

--
-**-*-*---*-*---*-*---*-----*-*-----*---*-*---*-----*-----*-*-----*---
Jon Lapham <lapham(at)jandr(dot)org> Rio de Janeiro, Brasil
Personal: http://www.jandr.org/
***-*--*----*-------*------------*--------------------*---------------

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Reuben D. Budiardja 2005-02-19 15:02:45 Client lib v. 7.3 to access 8.0 db server. Compatible ?
Previous Message Richard Crawley 2005-02-19 13:30:49 Method of building views