Group By with condition

From: JORGE MALDONADO <jorgemal1960(at)gmail(dot)com>
To: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Group By with condition
Date: 2015-05-21 22:14:41
Message-ID: CAAY=A7-zfNFtiaLn6d8PYsVreKZjdRRis46XZphsixN3nsQFZA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Steve Midgley 2015-05-21 22:29:20 Re: Group By with condition
Previous Message Suresh Raja 2015-05-21 16:51:31 Re: extracting PII data and transforming it across table.