MySQL Forums
Forum List  »  Newbie

Re: Basic sub-query in an UPDATE statement
Posted by: Harland Oracle
Date: June 19, 2021 07:34AM

All:
I am trying to update a 'batting' table with the TEAMNAME from the 'teams' table and I'm getting a 'sub-query contains more than 1 row' error

batting table - TeamName, TeamID
teams table - Name, TeamID
(TeamName and Team are supposed to be the same)

Guess I don't know how to do it...

UPDATE batting
SET TeamName=(SELECT name
FROM teams
WHERE teamID=teams.teamID);

Options: ReplyQuote


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


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.