显示错误
我认为语法错误
update invoice AS t1,
(select sum(total_cost) from invoice where billno='X-0125' and item='11') AS t2
set t1.total_cost=(t1.total_cost/(t2.sum(total_cost))*100
WHERE t1.billno='X-0125' and t1.item='11'
答案 0 :(得分:1)
在' 100'之后缺少一个paranthesis例如(取决于你想要的)但遗漏了一个:
update
invoice AS t1,
(
select
sum(total_cost)
from
invoice
where
billno = 'X-0125'
and item = '11'
) AS t2
set
t1.total_cost =(t1.total_cost /(t2.sum(total_cost)) * 100)
WHERE
t1.billno = 'X-0125'
and t1.item = '11'