Re: GROUP BY or alternative means to group

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: GROUP BY or alternative means to group
Дата
Msg-id 20120409182807.GA13464@wolff.to
обсуждение исходный текст
Ответ на Re: GROUP BY or alternative means to group  (Michael Gould <mgould@isstrucksoftware.net>)
Список pgsql-general
On Mon, Apr 09, 2012 at 13:55:04 -0400,
   Michael Gould <mgould@isstrucksoftware.net> wrote:
>Thanks that is a help. I would be nice if any key could be used as those are normally the things I would do group by's

This is what the 9.1 documentation says:
"When GROUP BY is present, it is not valid for the SELECT list expressions to
refer to ungrouped columns except within aggregate functions or if the
ungrouped column is functionally dependent on the grouped columns, since
there would otherwise be more than one possible value to return for an
ungrouped column. A functional dependency exists if the grouped columns (or
a subset thereof) are the primary key of the table containing the ungrouped
column."

That implies you need to group by a primary key. I haven't tested if
that (other keys can't provide this) is actually the case.

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

Предыдущее
От: Michael Gould
Дата:
Сообщение: Re: GROUP BY or alternative means to group
Следующее
От: Merlin Moncure
Дата:
Сообщение: Re: Resize numeric column without changing data?