Re: need aid with this query
From: kibeha <kibeha_at_post6.tele.dk>
Date: 2 Feb 2004 05:05:43 -0800
Message-ID: <444b180d.0402020505.6ee99ab2_at_posting.google.com>
Date: 2 Feb 2004 05:05:43 -0800
Message-ID: <444b180d.0402020505.6ee99ab2_at_posting.google.com>
Hi
I'd use :
select
customernumber,
count(decode(customerbranch,null,1,null)) number_of_null_branches
from t1
group by customernumber
having count(decode(customerbranch,null,1,null)) != 1;
The count(decode()) syntax will count null values in the
customerbranch column.
The having clause ensures that you only get customernumbers with
either zero or 2 or more null-values - so it also checks your
requirement of only one null value :-)
Regards
KiBeHa Received on Mon Feb 02 2004 - 14:05:43 CET