HI
all Experites can you help me on this Query How to get perfect result set
I have three table.
1)vitalsigns
ID DisplayName DisplayShort ToMetrics ToEnglish
1 Temp Temp (0.556*({1}-32)) ({1}/0.556)+32
2 BP(Systolic) BPH (NULL) (NULL)
3 Wt WtH {3}/2.2 {3}*2.2
4 Height Height 2.54*{4} {4}/2.54
5 Pulse Pulse (NULL) (NULL)
6 Respiratory Respiratory (NULL) (NULL)
7 Body Mass Index BMI (NULL) (NULL)
8 Wt WtL {8}*28.3 {8}/28.3
9 BP(Diastolic) BPL (NULL) (NULL)
2)xrefvitalsigns
vitalsignID Value TypeME
3 40 E
1 30 E
2 0 E
9 0 E
8 0 E
4 8.5 E
5 40 E
6 50 E
7 0 E
1 28 M
2 0 M
9 0 M
3 60 M
8 0 M
4 10.5 M
5 0 M
6 0 M
7 0 M
now, I want calculate the result based on this Like if my value come in matric then in query i want to calcultae in English
something like this
Select vitalsigns.DisplayShort,vitalsigns.ToEnglish,xrefvitalsigns.Value,xrefvitalsigns.TypeME
From xrefvitalsigns INNER JOIN vitalsigns
ON xrefvitalsigns.vitalsignID=vitalsigns.ID;
//now i want to calculate in query if my value Type me is in metric then convert it to english see the query and tell me the proper ans.
ho w to do it.
Select Case WHEN vitalsigns.DisplayShort='Temp' And xrefvitalsigns.TypeMe='M' Then ((xrefvitalsigns.Value/0.556)+32)
WHEN vitalsigns.DisplayShort='WtH' AND xrefvitalsigns.TypeMe='M' THEN (xrefvitalsigns.Value*2.2)
END AS VALUE
From xrefvitalsigns INNER JOIN vitalsigns
ON xrefvitalsigns.vitalsignID=vitalsigns.ID
Where vitalsigns.DisplayShort = 'WtH';