Re: simple? join

Поиск
Список
Период
Сортировка
От Christopher Kings-Lynne
Тема Re: simple? join
Дата
Msg-id GNELIHDDFBOCMGBFGEFOCEAMCBAA.chriskl@familyhealth.com.au
обсуждение исходный текст
Ответ на Re: simple? join  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: simple? join  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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



В списке pgsql-sql по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: SELECT * FROM xy WHERE name LIKE '%german special char'
Следующее
От: Tom Lane
Дата:
Сообщение: Re: simple? join