March 24, 2009 at 9:52 am
HI
i have a proc which displays the result as
CLAIMS CATEGORY
12345 P1
42342 P2
4234234 P3
but i want the result set to be displayed in this manner
CLAIMS P1 P2 P3
12345 x
42342X
4234234 x
so what i should i do.....
Thanks
March 24, 2009 at 10:10 am
raghu (3/24/2009)
HIi have a proc which displays the result as
CLAIMS CATEGORY
12345 P1
42342 P2
4234234 P3
but i want the result set to be displayed in this manner
CLAIMS P1 P2 P3
12345 x
42342X
4234234 x
so what i should i do.....
Thanks
Are the categories P1, P2, P3 fixed or are these dynamic?
March 24, 2009 at 10:11 am
THEY ARE FIXED
March 24, 2009 at 10:26 am
The following is test code. Look at it and adapt it as needed for your purposes:
declare @ClaimCat table(
Claims int,
Category char(2)
);
insert into @ClaimCat
select 12345, 'P1' union all
select 42342, 'P2' union all
select 4234234, 'P3'
;
select * from @ClaimCat;
select
Claims,
case when Category = 'P1' then 'X' else '' end as P1,
case when Category = 'P2' then 'X' else '' end as P2,
case when Category = 'P3' then 'X' else '' end as P3
from
@ClaimCat
;
March 24, 2009 at 10:39 am
Thank you very much lynn
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply