Reputation: 2763
There are 2 tables A and B, table A has data like this:
volumeA | dateA |
---|---|
1 | 2022-01-01 |
2 | 2022-01-01 |
3 | 2022-01-01 |
5 | 2022-01-02 |
8 | 2022-01-02 |
table B has data like this, with same number of rows as table A where dateB = 2022-01-01:
volumeB | dateB |
---|---|
0 | 2022-01-01 |
0 | 2022-01-01 |
0 | 2022-01-01 |
Now I'd like to copy volumeA from table A where date matches to table B (i.e. same date 2022-01-01), so table B will become this:
volumeB | dateB |
---|---|
1 | 2022-01-01 |
2 | 2022-01-01 |
3 | 2022-01-01 |
How to do this in MySQL?
Upvotes: 0
Views: 165
Reputation: 116
Not sure if I am missing something about your question, but if you could do what you describe then Table B would be in practice a copy of Table A, right?
Unless there are other columns in the two tables, that add some meaning to what you want to do (and possible provide a way to do what you want), I think that you are approaching this the wrong way.
Upvotes: 1