Access 2003
Hi All,
I have 2 Tables:
table1:
Field1,Field2
TT,NULL
TT,NULL
YY,NULL
YY,NULL
UP,NULL
Table2:
Info1,Info2,Info3
TT,1,Yes
TT,2,No
TT,3,No
YY,1,Yes
YY,2,No
YY,3,No
YY,4,No
UP,1,Yes
UP,2,Yes
UP,3,No
UP,4,No
What I would like to do is update table1, field2 with the data from table 2, info2 where the first instance of "No" is, then the next record and so on, then once table1 is updated, update the "No" to "Yes" in table2.
In the example above the result will be:
table1:
Field1,Field2
TT,2
TT,3
YY,2
YY,3
UP,3
Table2:
Info1,Info2,Info3
TT,1,Yes
TT,2,Yes
TT,3,Yes
YY,1,Yes
YY,2,Yes
YY,3,Yes
YY,4,No
UP,1,Yes
UP,2,Yes
UP,3,Yes
UP,4,No
I am familiar with doing updates with joins, but in this case I can't use an inner join between field1 and info1 as there are duplicates on either side. And this kind of has to loop or something simalar I think?
So I don't know where to start to achieve this.
As always, any information is appreciated.
Michael
Hi All,
I have 2 Tables:
table1:
Field1,Field2
TT,NULL
TT,NULL
YY,NULL
YY,NULL
UP,NULL
Table2:
Info1,Info2,Info3
TT,1,Yes
TT,2,No
TT,3,No
YY,1,Yes
YY,2,No
YY,3,No
YY,4,No
UP,1,Yes
UP,2,Yes
UP,3,No
UP,4,No
What I would like to do is update table1, field2 with the data from table 2, info2 where the first instance of "No" is, then the next record and so on, then once table1 is updated, update the "No" to "Yes" in table2.
In the example above the result will be:
table1:
Field1,Field2
TT,2
TT,3
YY,2
YY,3
UP,3
Table2:
Info1,Info2,Info3
TT,1,Yes
TT,2,Yes
TT,3,Yes
YY,1,Yes
YY,2,Yes
YY,3,Yes
YY,4,No
UP,1,Yes
UP,2,Yes
UP,3,Yes
UP,4,No
I am familiar with doing updates with joins, but in this case I can't use an inner join between field1 and info1 as there are duplicates on either side. And this kind of has to loop or something simalar I think?
So I don't know where to start to achieve this.
As always, any information is appreciated.
Michael