简体   繁体   中英

how do I find median in sql (code question)

I find answers below: Select round(S.LAT_N,4) mediam from station S where (select count(Lat_N) from station where Lat_N < S.LAT_N ) = (select count(Lat_N) from station where Lat_N > S.LAT_N)

I'm confused at where S come from??

S is an alias of station . The FROM clause is defining station as that alias S . With it defined this way station.{field} isn't valid, only S.{field} is.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM