MySQL Forums
Forum List  »  Newbie

Re: Basic sub-query in an UPDATE statement
Posted by: Peter Brawley
Date: June 19, 2021 08:13AM

With the team name in the teams table, it's entirely redundant in the batting table, should not be there, it's only an opportunity for data skew errors.

If you prefer not to correct that error, your query would be something like ...

UPDATE batting b
JOIN teams t USING(teamID)
SET b.TeamName=t.name;

Options: ReplyQuote


Subject
Written By
Posted
Re: Basic sub-query in an UPDATE statement
June 19, 2021 08:13AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.