March 24, 2014 at 7:59 pm
Hi friends i have small doubt in sql server please tell me how to solve this issuse in sql server.
table:patient
pn | cpt1 |cpt2 | cpt3| modi12 | modi13 | modi22 | modi33 | mod31|modi11
1 |100 |200 |300 | a | |g | k | v |q
2 |101 |400 |450 | h | b | | | m |
Here modi13 means modfiere1 with cpt3
modi12 means modifier1 with cpt2
modi22 means modifier2 with cpt2
modi33 means modifier3 with cpt3
modi31 means modifier3 with cpt1
modi11 means modifier1 with cpt1
modi13 means modifier1 with cpt3
based on this condition i need output like this
pn | cpt | modifier1 | modifier2 | modifier3
1 | 100 | q | |v
2 | 101 | | |m
1 | 200 | a | g |
2 | 400 | h | |
1 | 300 | | |k
2 | 450 | b | |
i tried cpt1,cpt2,cpt3 information stored in cpt useing unpivot.but here problem is how i displaay corresponding modfier1 and modifier2 and modifier3 values information.
select cpt from
( select pn,cpt1,cpt2,cpt3 from patient)main
unpivot
( cpt for cptvalues in (cpt1,cpt2,cpt3))sub that time i get only upto pn corresponding cpt values.
please tell me query how to solve this issue in sql server .
March 24, 2014 at 8:40 pm
Step 1 would be to make it easy for someone to give you a working, tested, coded solution. Please see the first link under "Helpful Links" in my signature line below for how to do that.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply