I have two tables:
- Client: clientid, latt, long
- Region: Regionid, latt, long
I want transfer Regionid from Region to Client, where latt and long columns are matched.
Here is my code. I have no idea what to do:
INSERT INTO Client (Region)
SELECT Region.Regionid
FROM Region
INNER JOIN Client ON Client.Latt = Region.Latt
AND Client.Long = Region.Long
WHERE Client.Latt = Region.Latt
AND Client.Long = Region.Long
Should I create a Region column in Client table first?
Any ideas are appreciated!