Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-sql by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group