Re: how to group by a joined query?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: how to group by a joined query?
Дата
Msg-id 513.1062421133@sss.pgh.pa.us
обсуждение исходный текст
Ответ на how to group by a joined query?  (Weiping He <laser@zhengmai.com.cn>)
Список pgsql-general
Weiping He <laser@zhengmai.com.cn> writes:
> laser_uni=# select t1.name, t1.addr, t2.name, t2.len, t2.of from t1
> right join t2 on t1.name=t2.name group by t2.name;
> ERROR:  Attribute t1.name must be GROUPed or used in an aggregate function

> seems the I must gorup all those fields:

> is it specification compliant or postgresql specific?

It's spec-compliant according to SQL92.

There is some amazingly complex verbiage in SQL99 that seems intended to
allow the system to deduce that some GROUP BY specs are redundant and
can be omitted.  We don't implement that (yet) and I don't think it
would apply to your example anyway, since neither table's name column
is marked as primary key.

            regards, tom lane

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

Предыдущее
От: Paul Thomas
Дата:
Сообщение: Re: About GPL and proprietary software
Следующее
От: "Bruno BAGUETTE"
Дата:
Сообщение: Where is the tool to migrate a mysql db to a PostgreSQL db ?