I am trying to get column data from one table to another. For example:
DestTable
Column1 Column2
1 NULL
2 NULL
3 NULL
SourceTable
Column3 Column4
1 63
2 18
3 21
I'm trying to get the values in Column4 to Column2. I've tried a couple of Update queries but I haven't found the right one yet. I started with:
Update DestTable
Set Column2 = SourceTable.Column4
Where Column1 = SourceTable.Column3
This wasn't allowed as I hadn't selected SourceTable in the Update clause, but I'm not allowed to select more than one table there.
I then figured I'd need a subquery here, so I tried:
Update DestTable
Set Column2 = (Select Column4
From SourceTable, DestTable
Where Column1 = Column3)
This won't work either, as it returns multiple values to the Set clause.
I'm pretty much stumped now. Can someone help me to find the right query for the job?
"Much that I bound, I could not free. Much that I freed returned to me."
(Lee Wilson Dodd)
DestTable
Column1 Column2
1 NULL
2 NULL
3 NULL
SourceTable
Column3 Column4
1 63
2 18
3 21
I'm trying to get the values in Column4 to Column2. I've tried a couple of Update queries but I haven't found the right one yet. I started with:
Update DestTable
Set Column2 = SourceTable.Column4
Where Column1 = SourceTable.Column3
This wasn't allowed as I hadn't selected SourceTable in the Update clause, but I'm not allowed to select more than one table there.
I then figured I'd need a subquery here, so I tried:
Update DestTable
Set Column2 = (Select Column4
From SourceTable, DestTable
Where Column1 = Column3)
This won't work either, as it returns multiple values to the Set clause.
I'm pretty much stumped now. Can someone help me to find the right query for the job?
"Much that I bound, I could not free. Much that I freed returned to me."
(Lee Wilson Dodd)