1

我需要使用来自课程表的适当费用更新注册表,以便所有参加名为“课程名称”的课程的客户

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 的新手。

4

1 回答 1

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';
于 2012-11-11T17:46:07.587 回答