From: | "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Frank Bax" <fbax(at)sympatico(dot)ca> |
Cc: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: simple? join |
Date: | 2002-01-08 01:54:29 |
Message-ID: | GNELIHDDFBOCMGBFGEFOCEAMCBAA.chriskl@familyhealth.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
> So, when and if we get around to implementing this particular SQL99
> feature, what you are suggesting will work. Right now it doesn't
> (and I'll wager that darn few other SQL implementations support this
> feature as yet, either).
I think MySQL does. I always found it strange that I had to add columns to
the group by clause in postgres that were functionally dependent on the
"real" grouped variable.
In fact, before I realised that you had to add them to the group by clause,
I just wrapped the functionally dependent fields in a MAX function (or min,
whatever).
ie. SELECT orders.product_id, MAX(product_name), MAX(unit_price) FROM
products NATURAL JOIN orders GROUP BY orders.product_id;
In fact, if one created a 'do nothing' aggregate function, you could avoid
having to add things to the group by clause in a cleaner fashion.
Chris
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-01-08 03:25:19 | Re: simple? join |
Previous Message | Tom Lane | 2002-01-08 00:26:31 | Re: SELECT * FROM xy WHERE name LIKE '%german special char' |