<p><font size="2">Hi Steve,<br /><br /> > I believe count will only count not-null anyway<br /> > so this will
alwaysreturn zero.<br /><br /> Understood. But that doesn't help me...<br /> What I need is a query expression that I
cansubstitute<br /> for isblabla below:<br /><br /> select maf<br /> from gallo.sds_seq_reg_shw<br /> where
mafisblabla;<br /><br /> Regards,<br /><br /> Tena Sakai<br /> tsakai@gallo.ucsf.edu<br /><br /><br /> -----Original
Message-----<br/> From: Steve Crawford [<a
href="mailto:scrawford@pinpointresearch.com">mailto:scrawford@pinpointresearch.com</a>]<br/> Sent: Tue 6/30/2009 3:39
PM<br/> To: Tena Sakai<br /> Cc: pgsql-sql@postgresql.org<br /> Subject: Re: [SQL] it's not NULL, then what is it?<br
/><br/> ...<br /> ><br /> ><br /> > canon=# select count(maf) from gallo.sds_seq_reg_shw<br /> >
canon-# where maf ISNULL;<br /> > count<br /> > -------<br /> > 0<br /> > (1 row)<br />
><br/> I believe count will only count not-null anyway so this will always<br /> return zero. Try count(*) instead
ofcount(maf). Here's an example:<br /><br /> steve@[local]=> select * from barr;<br /> LOG: duration: 0.226 ms<br
/> a | b<br /> ---+---<br /> a | b<br /> c | d<br /> | e<br /> (3 rows)<br /><br /> steve@[local]=> select
coalesce(a,'a is null'), coalesce(b, 'b is<br /> null') from barr;<br /> LOG: duration: 0.283 ms<br /> coalesce |
coalesce<br/> -----------+----------<br /> a | b<br /> c | d<br /> a is null | e<br /> (3 rows)<br
/><br/> steve@[local]=> select count(a) from barr;<br /> LOG: duration: 0.339 ms<br /> count<br /> -------<br />
2<br /> (1 row)<br /><br /> steve@[local]=> select count(*) from barr where a isnull;<br /> LOG: duration:
0.350ms<br /> count<br /> -------<br /> 1<br /> (1 row)<br /><br /><br /><br /></font>