Skip to content

Instantly share code, notes, and snippets.

@voycey
Last active December 31, 2019 05:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save voycey/657f852431d377dd2cba9e6ccf428ada to your computer and use it in GitHub Desktop.
Save voycey/657f852431d377dd2cba9e6ccf428ada to your computer and use it in GitHub Desktop.
SQL
SELECT m.id, d.name, d.brand, d.wkt from dealerships d
LEFT JOIN movement m ON ST_CONTAINS(d.wkt, ST_POINT(m.lng, m.lat))
WHERE d.brand IN ('AUDI', 'BMW')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment