Uri Dimant
3/21/2007 2:06:00 PM
Hi
create table #t (Number int,Desc1 varchar(50))
insert into #t values (1234,'Blah Blah1')
insert into #t values (1234,'Blah Blah2')
select number, max(case when Desc1='Blah Blah1' then Desc1 end) as Desc1,
max(case when Desc1='Blah Blah1' then Desc1 end) as Desc2
from #t group by number
"schaapiee" <drobertmiller@yahoo.com> wrote in message
news:1174483769.989926.107790@e65g2000hsc.googlegroups.com...
>I have a 'Number' which has multiple descriptions, and I want them to
> return on the same line in multiple columns instead of returning
> duplicate records. The info in all the other columns is identical.
> There is a number tied to the Desc items; so if you were to say Where
> Desc1 = 1 it would only return Blah Blah1.
>
> Here is my example:
>
> Number Desc1
>
> 1234 Blah Blah1
> 1234 Blah Blah2
>
> I want it to show, how can I do this?
>
> Number Desc1 Desc2
>
> 1234 Blah Blah1 Blah Blah2
>
> I have written a case structure that returns the following instead,
> which I dont want
>
> Number Desc1 Desc2
>
> 1234 Blah Blah1 NULL
> 1234 NULL Blah Blah2
>