I ran this query successfully, but the column highwayid isn't updated as expected:
update unique_latlongs set highwayid = (SELECT h.osmid FROM rn.highways h WHERE h.geom && ST_Expand(ST_Transform(st_setsrid(st_makepoint(lon, lat),4326), 3414), 50) ORDER BY ST_Distance(h.geom, ST_Transform(st_setsrid(st_makepoint(lon, lat),4326), 3414)) limit 1);
What do you think could be wrong in this query? In unique_latlongs, lat and lon are columns.
EDIT: Perhaps I should explain what I was trying to do: I have lat and long values in the unique_latlongs table. I also have the column highwayid, which I want to update to the id the the closest highway to each respective lat long in unique_latlongs. The highways are store in the rn.highways table, with the h.geom being the geometry value of the highway.