我需要更新注册表,并在课程表中为所有参加课程名称为“课程名称”的客户提供适当的费用
update from enrollment as e
join course as c on c.coursenumber = e.coursenumber
join customer as cs on cs.customernumber = e.customernumber
set e.amountpaid = course.fee
where e.coursenumber in (select coursenumber from course where course = 'COURSE NAME');
这可能在mysql中吗?我对这个DBMS和sql很新。
答案 0 :(得分:0)
只需删除FROM
关键字。
update enrollment as e
join course as c on c.coursenumber = e.coursenumber
join customer as cs on cs.customernumber = e.customernumber
set e.amountpaid = course.fee
where e.coursenumber in (select coursenumber from course where course = 'COURSE NAME');
或直接不用IN
update enrollment as e
join course as c on c.coursenumber = e.coursenumber
join customer as cs on cs.customernumber = e.customernumber
set e.amountpaid = course.fee
where c.course = 'COURSE NAME';