have table1,
F1 F2 F3
1A 2 3
1A
1A
1A is a indexed filed
now possible to update the F2 and F3, based F1=1A and F2 and F3 is just filled, and F2 is null?
i need:
F1 F2 F3
1A 2 3
1A 2 3
1A 2 3
peraphs i just post and remember only to macke a new virtula table1_1 and join the F1 fields....
UPDATE records with already data exists
-
- PlatinumLounger
- Posts: 4370
- Joined: 26 Apr 2010, 17:36
-
- Administrator
- Posts: 78629
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: UPDATE records with already data exists
What if there are records like this?
Or is that impossible?
Or is that impossible?
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4370
- Joined: 26 Apr 2010, 17:36
Re: UPDATE records with already data exists
no possible, the combination is always:HansV wrote:What if there are records like this?
Or is that impossible?
1A 2 3
in effect 1A is a silmilar ZIP code, 2 the way, 3 the city name
not possible to have zip code with different indication.
-
- Administrator
- Posts: 78629
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: UPDATE records with already data exists
You can use the following SQL:
UPDATE Table1 AS A INNER JOIN Table1 AS B ON A.F1 = B.F1 SET A.F2 = B.F2, A.F3 = B.F3 WHERE A.F2 Is Null AND B.F2 Is Not Null
UPDATE Table1 AS A INNER JOIN Table1 AS B ON A.F1 = B.F1 SET A.F2 = B.F2, A.F3 = B.F3 WHERE A.F2 Is Null AND B.F2 Is Not Null
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4370
- Joined: 26 Apr 2010, 17:36
Re: UPDATE records with already data exists
tested and WORK!HansV wrote:You can use the following SQL:
UPDATE Table1 AS A INNER JOIN Table1 AS B ON A.F1 = B.F1 SET A.F2 = B.F2, A.F3 = B.F3 WHERE A.F2 Is Null AND B.F2 Is Not Null
TKS.