Solved

MySQL update based on data from another table

Posted on 2009-04-15
4
205 Views
Last Modified: 2012-05-06
I need to update a field in a table based on a field from another table. I am only familiar with using Joins with a Select statement so I know my syntext is wrong... can someone please show me the correct syntext.
Update HanStores T SET T.AuditCompany = 'WRP' 
Left outer join HanAR T1 On T.StoreNum = T1.StoreID
Where T1.Auditor LIKE 'Carl%'

Open in new window

0
Comment
Question by:dannyg280
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 24148374
Update HanStores
SET AuditCompany = 'WRP'
FROM HanStores T Left outer join
      HanAR T1 On T.StoreNum = T1.StoreID
Where T1.Auditor LIKE 'Carl%'
0
 

Author Comment

by:dannyg280
ID: 24149064
Thanks for the responce.... I'm still getting a syntext error
"#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM HanStores T
Left outer join
      HanAR T1 On T.StoreNum = T1.StoreID
' at line 3
"

I'm using MySQL 5.0
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 24151258
a OUTER join  does not make any sense in your example..
http://dev.mysql.com/doc/refman/5.0/en/update.html
Update HanStores T, HanAR T1  
  SET T.AuditCompany = 'WRP' 
WHERE T.StoreNum = T1.StoreID
 and T1.Auditor LIKE 'Carl%'

Open in new window

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
Your data is at risk. Probably more today that at any other time in history. There are simply more people with more access to the Web with bad intentions.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question