macaalay.com
Median Calculation using TSQL (no cursors)
Before we start lets define what a Median is first, in laymans term the Median is the “middle number” in a sorted list of numbers.