Hi, i am using ms sql server and need to implement get the median of a set of values. i have looked all over the web and cant find a simple explanation.
i would appreciate it if anyone can provide me with a very simple explanation. i understand how it works in terms of having to first order the values ascending and then pick the middle value in the list if there is an odd number of rows, or take the 2 middle values and get the average value of these 2 values if there is an even number of rows. however i have no idea on how to implement this into my query The following is the sql statement that i need to adapt, i need to get the median value of the srtot value within the query. select pat_demid, pat_lastname, meas_gendate, meas_id, test_gendate, avg(srtot)as meansrtot, avg(sreff)as meansreff, avg(BFRaw)as BF_Rawmean, avg(BFTGV)as BF_TGVmean, ((stdev(srtot)/avg(srtot))*100) as srtotcv, ((stdev(sreff)/avg(sreff))*100) as sreffcv, ((stdev(BFRaw)/avg(BFRaw))*100) as BF_Rawcv, ((stdev(BFTGV)/avg(BFTGV))*100) as BF_TGVcv, count(srtot)as countsrtot, count(sreff)as countsreff from bodyparametersf where (srtot is not null) OR (sreff is not null) group by pat_demid, pat_lastname, meas_gendate, meas_id, test_gendate i would appreciate any of your advice in relation to this thanks very much ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Upgrade to Adobe ColdFusion MX7 The most significant release in over 10 years. Upgrade & see new features. http://www.adobe.com/products/coldfusion Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:272343 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4