1

I know that there are other queries already given to find the median but I want to know how this query is working

Select round(S.LAT_N,4) median from TEST.meadian S where (select count(Lat_N) from TEST.meadian where Lat_N > S.LAT_N ) = (select count(Lat_N) from TEST.meadian WHERE Lat_N > S.LAT_N);

If their are total 449 rows than this query returns 448

Select round(S.LAT_N,4) median from TEST.meadian S  where  (select count(Lat_N) from TEST.meadian where Lat_N > S.LAT_N );

If there are total 449 rows than this query returns 448

Select round(S.LAT_N,4) median from TEST.meadian S  where  (select count(Lat_N) from TEST.meadian where Lat_N < S.LAT_N )

Then how it is finding median fro a given for odd no of rows.

Dharman
  • 21,838
  • 18
  • 57
  • 107
  • @tim-biegeleisenn i know there are other queries to find the median But i am not able to understand how this query works if you can please explain it – Bakul Mittal May 19 '17 at 16:45

0 Answers0