I would like to know how to calculate the median of<br>multiple fields in my table. The result would be<br>Field 1 Median = X, Field 2 Median = Y<br><br>This is my SQL Median Statement for a single field<br>--------------------------------------------------<br>DECLARE @A_Median <br>SELECT @A_Median = AVG(DISTINCT Field_1)FROM<br>(SELECT F1.Field_1 FROM Table F1, Table F2<br>GROUP BY F1.Field_ID, F1.Field_1<br>HAVING SUM(CASE WHEN F2.Field_1 = F1.Field_1 THEN 1 ELSE 0 END)<br>>= ABS(SUM(CASE WHEN F2.Field_1 < F1.Field_1 THEN 1<br>WHEN F2.Field_1 > F1.Field_1 THEN –1<br>ELSE 0 END )))<br>AS Median<br>-----------------------------------------------------<br><br>My aim is a single SQL to retrieve the Median of multiple<br>filds.<br><br>Thanks in advance<br>