I would like to update my table called nfl_roster with weekly scores that I have imported into another table (currently called week7_stats for the week I am doing it for now). For example, in nfl_roster I have all of the players and then empty columns where I will input the scores as the week goes. Here's an example of what it looks like:
Name week1_points week2_points ..... week7_points
A.J. Green 0 0 0
Matthew Stafford 0 0 0
Here is an example of the sheet where I have all of the scores for the players for week 7:
name week7_points
Matthew Stafford 3.590
Blake Bortles 2.894
So I need to update nfl_roster with weekly scores from another table (in this case week7_stats) and have it UPDATE the score in that week with the column in the weekly table.
更新nfl_roster加入week7_stats ON nfl_roster.Name = week7_stats.name SET nfl_roster.week7_points = week7_stats.week7_points
Try this:
update nfl_roster
set week7_points = (
select week7_points
from week7_stats
where nfl_roster.Name = week7_points.name
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.