Re: Group by failing on Null values

From: Rosser Schwarz <rosser(dot)schwarz(at)gmail(dot)com>
To: Caleb Simonyi-Gindele <csg(at)bordervet(dot)ca>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Group by failing on Null values
Date: 2004-07-19 22:29:32
Message-ID: 37d451f70407191529610a8eba@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

while you weren't looking, Caleb Simonyi-Gindele <csg(at)bordervet(dot)ca> wrote:

> How do I get it to produce a row even when dat_staff_code is null?

try something like

SELECT coalesce(dat_staff_code, 0)...GROUP BY dat_staff_code

That will substitute a zero for any NULL value in that column, which
GROUP BY should then pick up.

/rls

--
:wq

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message sad 2004-07-20 05:36:44 locks and triggers. give me an advice please
Previous Message Caleb Simonyi-Gindele 2004-07-19 22:11:05 Group by failing on Null values