I have two tables (with sample data):
tblZone
[ZoneNo] [Zone] -----1------Zone1 -----2------Zone2 -----3------Zone3
tblPointsClient
[PolygonID] [Zone Name] -----0------------Zone1 -----0------------Zone1 -----0------------Zone1 -----0------------Zone2 -----0------------Zone2 -----0------------Zone2 -----0------------Zone3 -----0------------Zone3 -----0------------Zone3
Basically, using MySQL, I'm trying to update the PolygonID in tblPointsClient so that ZoneNo for the zone in tblZone (if that makes sense).
Therefore, when I run this update, it should change PolygonID to:
[PolygonID] [Zone Name] -----1------------Zone1 -----1------------Zone1 -----1------------Zone1 -----2------------Zone2 -----2------------Zone2 -----2------------Zone2 -----3------------Zone3 -----3------------Zone3 -----3------------Zone3
I tried the following:
UPDATE tblPointsClient SET tblPointsClient.PolygonID = ( SELECT ZoneNo FROM tblZones WHERE tblPointsClient.ZoneNo = tblZones.Zone )
but it did everything PolygonID 0
If anyone can help, that would be much appreciated! :)
source share