Skip to main content
1 of 13
geozelot
  • 30.9k
  • 4
  • 34
  • 57

No need for JOIN LATERAL (or do you really just want to use it?); try

UPDATE gps
SET stop_id = (
  SELECT stop_id
  FROM stops
  ORDER BY gps.geom <-> stops.geom
  LIMIT 1
);
geozelot
  • 30.9k
  • 4
  • 34
  • 57