Advertisement
Infernale

The Manhattan Distance [NCTU Floor 23]

Dec 21st, 2019
489
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.37 KB | None | 0 0
  1. #Format : LIMIT s-1, t - (s - 1)
  2. SELECT ROUND(ABS(x1 - x2) + ABS(y1 - y2), 4)
  3.     FROM (SELECT MIN(lon) x1,  MAX(lon) x2
  4.             FROM (SELECT*FROM citytable
  5.                 WHERE lat < 121.8 ORDER BY lat DESC LIMIT 3, 15) AS Table1) AS latTable,
  6.          (SELECT MIN(lat) y1, MAX(lat) y2
  7.             FROM (SELECT*FROM citytable
  8.                 WHERE lon > 25.1 ORDER BY lon ASC LIMIT 3, 15) AS Table2) AS lonTable;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement