I have two tables. I'd like to update a row in table1 based on the same row index in table2. The IDs don't match but but the ID in table 2 matches the row index. There will always be more data in table 2, but I don't care if the extra rows are missed.
How would I achieve this in a mysql UPDATE statement?
table 1 ______________ table 2 _____________
Row number | id | value | Row number | id | value |
|--------------| |-----|-------|
1 | 2 | A | 1 | 1 | W |
2 | 4 | B | 2 | 2 | X |
3 | 6 | C | 3 | 3 | Y |
4 | 4 | Z |
to:
table 1 ______________
Row number | id | value |
|--------------|
1 | 2 | W |
2 | 4 | X |
3 | 6 | Y |