| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.oracle -> Re: need aid with this query
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 - 07:05:43 CST
![]() |
![]() |