Guru Ji
asked on
SQL Update Query joining two different databases
Hi have two databases
Current and CurrentBackup
Both have exact same structure the only thing I want is to move data from field int6 from CurrentBackup to Current based on id
So here is the table structure
Current
id
int6
CurrentBackup
id
unt6
Please help me how to transfer all int6 data based on matching id from currentback to current in one query.
Thanks
Current and CurrentBackup
Both have exact same structure the only thing I want is to move data from field int6 from CurrentBackup to Current based on id
So here is the table structure
Current
id
int6
CurrentBackup
id
unt6
Please help me how to transfer all int6 data based on matching id from currentback to current in one query.
Thanks
ASKER
I want to match the id as well. so that the data entered into Current should be with matching id of CurrentBackup
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Chris,
I am not getting any data with the first select statement. Though I verified that there is data.
If I put WHERE CT.int6 = CBT.int6
Then it shows just one row which I remember edited manually.
Do you why I am not getting any data ?
I am not getting any data with the first select statement. Though I verified that there is data.
If I put WHERE CT.int6 = CBT.int6
Then it shows just one row which I remember edited manually.
Do you why I am not getting any data ?
Is one of them NULL?
in that case change it to
WHERE COALESCE(CT.int6, -9999) <> COALESCE(CBT.int6, -9999)
in that case change it to
WHERE COALESCE(CT.int6, -9999) <> COALESCE(CBT.int6, -9999)
ASKER
Thank you so much Chris
Glad to help!
ASKER
sure, looking at it now
taking a look at it now! :)
INSERT INTO CurrentBackup.unt6
SELECT * FROM Current.int6