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
|
Список | 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 tblTable1INNER JOIN ............GROUP BY fld1, fld2, fld3, fld4What 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 по дате отправления: