Copy column from one table to another

I have a table called 'latlon' - It has 3 columns - hhid,latitude,longitude

I have another table in the same db called master. It has 30,000 records.

the hhid in master is the same  as the hhid in latlon.

I need to copy the latitude and longitude into the master table where hhid = hhid in table latlon


What is the query to do this?
lvollmerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

snoyes_jwCommented:
UPDATE master JOIN latlon USING (hhid) SET master.latitude = latlon.latitude, master.longitude = latlon.longitude;
todd_farmerCommented:
UPDATE master, latlon SET master.latitude=latlon.latitude, master.longitude=latlon.longitude WHERE master.hhid=latlon.hhid;
Guy Hengel [angelIII / a3]Billing EngineerCommented:
update master, latlon
  set master.latitude = latlon.latitude, master.longitude = latlon.latitude
where master.hhid = latlon.hhid
 

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
I guess snoyes and todd's suggestions are valid also (if not "identical") ...
todd_farmerCommented:
Hmm....

You accepted an answer from angelIII that is EXACTLY the same as my earlier post, as best I can tell.  My post is almost identical to snoyes_jw's (although his has uses a JOIN syntax that mine does not).

You should accept the first correct answer.  Can you explain what was wrong with the first two?  If you decide to change your accepted answer, you may post a request to the Support topic area asking that this question be reopened for regrading.

Thanks!
lvollmerAuthor Commented:
Sorry todd, when I clicked the link in the email it defaulted right to angel's post. I did not even see there were answers above the post. I am sorry.
todd_farmerCommented:
No problem - I think snoyes_jw's solution will work and should likely get the credit (although I have never used the JOIN syntax in an UPDATE statement myself).  If you post a request to the Support topic area (it's free), they will reopen the question so that you can accept the correct answer.

Thanks!
lvollmerAuthor Commented:
I will post over there, thanks
Guy Hengel [angelIII / a3]Billing EngineerCommented:
todd_farmer >You should accept the first correct answer.
hhmmm... actually, if all the answers are working/correct (and posted in such a small time interval like here), a split points is what should be done...
todd_farmerCommented:
I'm just reiterating what is said in the FAQs:

If a comment posted by an Expert has answered your question, then you should select the Expert's comment as the answer to your question. In case of duplicate or similar comments, you should always select the first comment posted.

http://www.experts-exchange.com/help.jsp#hi68

I'm happy to receive points whenever anybody wants to give them to me, but it sure seems to me like snoyes_jw got the answer right first.  Yes, it stinks to be the second (or third) person posting the same correct solution in a matter of minutes (or less), but I don't read anything that says that points should be split if duplicate answers are given in a short period of time.  If there's something that says to do it that way, please let us know.
Guy Hengel [angelIII / a3]Billing EngineerCommented:
I actually agree with you.
however, both #68 and #69 leave the freedom to the questionner to split the points.
And honestly I think the FAQ should be slightly modified for this case...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.