Skip to content

Instantly share code, notes, and snippets.

@vmleon
Last active January 14, 2021 16:18
Show Gist options
  • Save vmleon/a8b2e2e015b2c7455996343fe7ed38a6 to your computer and use it in GitHub Desktop.
Save vmleon/a8b2e2e015b2c7455996343fe7ed38a6 to your computer and use it in GitHub Desktop.
Find the 5 customers closest to the warehouse whose warehouse ID is 3.
SELECT BRANCH_NAME
FROM
BRANCHES B,
WAREHOUSES W
WHERE
W.WAREHOUSE_NAME = 'Odessa Warehouse'
AND SDO_NN(B.GEOMETRY, W.GEOMETRY, 'sdo_num_res=5 unit=km', 1) = 'TRUE';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment