I need some help in finding nearest points of each entry of a particular table to another if and only if the nearest entry comes within 10 miles.
2 tables are here:
Table A
lon | lat | block_id
and
table B
city | latitude | longitude | block_id
-------------------+----------+-----------+----------
Now, I have to update blockid of table A with the one of Table B which is closest to that entry and if within 10 miles. If no match found, maybe update it "NA". Table A consists of a million entries, table B 10 entries.
I am working with postgres 9.4. I am quite new to postgres, hence not very comfortable in it although fairly comfortable with sql.
Please bear with me if any mistakes. Thanks a lot for your help, I am stuck bad.
Thanks a lot,
<->operator for fast searchs