Following the information and help from this one SQL Update info using other record from the same table
I noticed it is not doing the job properly.
The problem is:
It is joining the table NOEUD with table created from the sub-query inside inner join. It updates only the noeud from the sub-query table and not the all nodes from the noeud table.
The selection is made properly on the sub-query (list all the fields that has noeud.n_amont = noeud.noeud with 1m cable distance) because n_amont is the previous noeud. I want to update all the n_amont from the selection which matches the correspondent noeud from the whole table noeud.
Thanks in advance.
UPDATE [SELECT noeuds.* FROM noeuds WHERE (((noeuds.LONG_CABLE)=" 1") AND (noeuds.DELETED=" "))]. AS a INNER JOIN noeuds AS n ON a.n_amont=n.noeud SET n.INSEE_COM = a.INSEE_COM, n.RIVOLI = a.RIVOLI, n.NUM_VOIE = a.NUM_VOIE
WHERE ((n.INSEE_COM)=" ");
Can anyone help?
EDIT:
I have this table (noueds):
NOEUD TYPE_MAT N_AMONT LONG_CABLE RIVOLI (+3 fields for update)
123 REP 100 12 abc
130 AMP 229 12
173 PPP 130 1 AAA
I would like to write an UPDATE query to fill all the data ADDRESS from node after the one that has NODES.LONG_CABLE = 1.
For example:
I searched all the nodes that have LONG_CABLE = 1, gives me noeud 173; then the node before 130 should have the same rivoli of 173.
This cable gives me the address of this equipment installed on certain streets. When I fill the PPP (type) it do not translate the address to the one at the same pole or manhole (1 m distant = connector).
With this query I posted I can select the nodes that has a previous one (173) but when joining it only joins the n_amont 130 (node related 130), if it is 1m distant from other equip. in this case it is ignored and the address is not updated. The query sould run on table NOEUDS and then find the equips that needs updates.
Any more sugestion on fixing this?