Hi,
This is one simple solution (didn't count on the performance):
create table CustInfo
(UniqId int identity(1,1),
UniqClient int,
PhoneNumber varchar(20),
EmailWeb varchar(50)
)
insert into CustInfo (UniqClient,PhoneNumber,EmailWeb)
values(66,'4164445555',''),(66,'','fstest1@test.com')
select top(1) t.UniqClient,
(select top (1) t2.PhoneNumber from dbo.CustInfo t2 where t2.UniqClient = t.UniqClient and len(isnull(t2.PhoneNumber,'')) > 0) as PhoneNumber,
(select top (1) t3.EmailWeb from dbo.CustInfo t3 where t3.UniqClient = t.UniqClient and len(isnull(t3.EmailWeb,'')) > 0) as EmailWeb
from dbo.CustInfo t
where t.UniqClient = 66
You can add an ORDER BY if you need a reason for.
Regards,
Igor
Igor Micev,My blog: www.igormicev.com