We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Weather Observation Station 18
Weather Observation Station 18
Sort by
recency
|
2379 Discussions
|
Please Login in order to post a comment
Heres the working solution for MSSQL: SELECT CAST( ROUND( ABS(MAX(LAT_N) - MIN(LAT_N)) + ABS(MAX(LONG_W) - MIN(LONG_W)), 4) as decimal(10,4) ) AS MANHATTAN_DISTANCE FROM STATION;
SELECT ROUND(MAX(STATION.LAT_N) - MIN(STATION.LAT_N) + MAX(STATION.LONG_W) - MIN(STATION.LONG_W), 4) AS MANHATTAN_DISTANCE FROM STATION;
` select round(max(LAT_N)-min(LAT_N)+max(LONG_W)-min(LONG_W),4) from station;
`
select round(convert(decimal(10,4),abs(min(lat_n)-max(lat_n))+abs(min(long_w)-max(long_w))),4) from station;
Using MS SQL I Used Variable's and the ABS Function to give me absoulute differences between the values:
DECLARE @A NUMERIC(20, 8) DECLARE @B NUMERIC(20, 8) DECLARE @C NUMERIC(20, 8) DECLARE @D NUMERIC(20, 8)
SET @A = (SELECT MIN(Lat_N) FROM Station) SET @B = (SELECT MIN(Long_W) FROM Station) SET @C = (SELECT MAX(Lat_N) FROM Station) SET @D = (SELECT MAX(Long_W) FROM Station)
SELECT CAST(ROUND((ABS(@A - @C) + ABS(@B - @D)), 4) AS Decimal(10,4)) AS Manhattan_Distance