“from”在此位置无效,需要:EOF、“;”

Thi*_*yen 5 mysql sql

我尝试将 John Smith 的工资增加 10%,并假设我不知道 John Smith 的 emp_number。

update m
    set m.mon_hourly_pay_rate = m.mon_hourly_pay_rate*1.1
from monthly_pay m
inner join Employee e
    on e.emp_number=m.emp_number
where e.emp_name = "John Smith";
Run Code Online (Sandbox Code Playgroud)

有人可以帮助我吗?from 有红色下划线的单词表示“from”在此位置无效,期望:EOF,“;” 但我用谷歌搜索了一下,没有发现什么问题

Ank*_*pai 6

你的语法不正确。您需要使用 MySQL 语法:

update monthly_pay m
       inner join Employee e
       on e.emp_number=m.emp_number
set m.mon_hourly_pay_rate = m.mon_hourly_pay_rate*1.1
where e.emp_name = "John Smith";
Run Code Online (Sandbox Code Playgroud)