>select MyValue from MyTable into cursor Temp; > order by MyValue; > nofilter >goto reccount() / 2 >? MyValue >>
lnRecCnt = RECCOUNT() IF (lnRecCnt % 2 ) =1 && Odd # of records GOTO ( CEILING( lnRecCnt/2 ) ) lnMedian = MyValue ELSE GOTO ( lnRecCnt/2 ) lnMedian = MyValue SKIP lnMedian = (lnMedian + MyValue) / 2 ENDIF