简体   繁体   English

SQL查询涉及子查询

[英]SQL query involving sub-Query

I want to write a query to find the corresponding Western Longitude value for the greatest value of the Northern Latitudes less than 137.2345 up to 4 decimal places. 我想写一个查询来查找相应的Western Longitude值,以获取小于137.2345的北纬最大值,最多保留4位小数。 I wrote the following query 我写了以下查询

SELECT TO_CHAR(LONG_W,'999.9999') 
FROM STATION WHERE LAT_N =(SELECT TO_CHAR(MAX(LAT_N),'999.9999')
FROM STATION WHERE LAT_N<'137.2345');

I didn't get the ouput , Please guide me ! 我没有得到输出,请引导我!

I had a hard time following the question. 我很难回答这个问题。 This query will give you the LONG_W for the maximum lat_n < 137.2345 该查询将为您提供最大lat_n <137.2345的LONG_W

select TO_CHAR(LONG_W,'999.9999')
from station where lat_n = (select max(lat_n) from station where lat_n < '137.2345')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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