> 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