Re: Group By with condition

Поиск
Список
Период
Сортировка
От Steve Midgley
Тема Re: Group By with condition
Дата
Msg-id CAJexoS+xfmkmZT+-YgYaN4Y+2BpnnMBkLmStvJduLHmsh_c00w@mail.gmail.com
обсуждение исходный текст
Ответ на Group By with condition  (JORGE MALDONADO <jorgemal1960@gmail.com>)
Ответы Re: Group By with condition  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-sql
I'm not totally clear on your requirement but would the HAVING keyword solve the problem? That's kind of like a WHERE but in the group by phase of the query..

SELECT fld1, fld2, fld3, fld4 FROM tblTable1
INNER JOIN ............
GROUP BY fld1, fld2, fld3, fld4
HAVING fld4='TL'


On Thu, May 21, 2015 at 3:14 PM, JORGE MALDONADO <jorgemal1960@gmail.com> wrote:
Let´s suppose I have the following query:

SELECT fld1, fld2, fld3, fld4 FROM tblTable1
INNER JOIN ............
GROUP BY fld1, fld2, fld3, fld4

What I need is to group by "fld4" if and only if its value is "TL". If its value is different than "TL" then no grouping should be performed on this field.

I will very much appreciate ypur feedback.

Respectfully,
Jorge Maldonado

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

Предыдущее
От: JORGE MALDONADO
Дата:
Сообщение: Group By with condition
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: Group By with condition