From: | "Tena Sakai" <tsakai(at)gallo(dot)ucsf(dot)edu> |
---|---|
To: | "Steve Crawford" <scrawford(at)pinpointresearch(dot)com> |
Cc: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: it's not NULL, then what is it? |
Date: | 2009-07-01 00:58:21 |
Message-ID: | FE44E0D7EAD2ED4BB2165071DB8E328C04E84C04@egcrc-ex01.egcrc.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hi Steve,
> I believe count will only count not-null anyway
> so this will always return zero.
Understood. But that doesn't help me...
What I need is a query expression that I can substitute
for isblabla below:
select maf
from gallo.sds_seq_reg_shw
where maf isblabla;
Regards,
Tena Sakai
tsakai(at)gallo(dot)ucsf(dot)edu
-----Original Message-----
From: Steve Crawford [mailto:scrawford(at)pinpointresearch(dot)com]
Sent: Tue 6/30/2009 3:39 PM
To: Tena Sakai
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] it's not NULL, then what is it?
...
>
>
> canon=# select count(maf) from gallo.sds_seq_reg_shw
> canon-# where maf ISNULL;
> count
> -------
> 0
> (1 row)
>
I believe count will only count not-null anyway so this will always
return zero. Try count(*) instead of count(maf). Here's an example:
steve(at)[local]=> select * from barr;
LOG: duration: 0.226 ms
a | b
---+---
a | b
c | d
| e
(3 rows)
steve(at)[local]=> select coalesce(a, 'a is null'), coalesce(b, 'b is
null') from barr;
LOG: duration: 0.283 ms
coalesce | coalesce
-----------+----------
a | b
c | d
a is null | e
(3 rows)
steve(at)[local]=> select count(a) from barr;
LOG: duration: 0.339 ms
count
-------
2
(1 row)
steve(at)[local]=> select count(*) from barr where a isnull;
LOG: duration: 0.350 ms
count
-------
1
(1 row)
From | Date | Subject | |
---|---|---|---|
Next Message | Tena Sakai | 2009-07-01 02:09:02 | Re: it's not NULL, then what is it? |
Previous Message | Tena Sakai | 2009-07-01 00:56:36 | Re: it's not NULL, then what is it? |