Jump to content

Merging similar columns from different databases...


Jim R

Recommended Posts

I'm hoping writing down my issue will help me find the logic in it.  I have two tables in two different databases that are essentially the same.  I've updated each separately at different times without remembering I had two of them.  Now I'm trying to merge information from the email columns.

 

These are coaching jobs which have changed since last year.  There were around 90 changes.

 

I'm trying to move the emails I have in t2 that I don't have in t1.  I have NULL cells in both columns, and I don't want to overwrite emails I already have in t1 with NULL cells I have in t2. 

 

I need something that Sets t1.email Where t1.email isn't equal to t2.email and t2.email Is Not Null.  (I should have done this before I changed the coaches' names.  I could have used that as a trigger.) 

 

Would that be the logic?  I definitely need help with the syntax.

 

UPDATE jwrbloom_hhr.hhr_schools t1 
JOIN jwrbloom_hhm.schools t2 
ON t1.id = t2.id
SET t1.email = t2.email
WHERE ??????

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.