gpt4 book ai didi

mysql - SQL 语法错误。我的语法错误在哪里?

转载 作者:行者123 更新时间:2023-11-29 02:21:25 24 4
gpt4 key购买 nike

我这辈子都不能发现我的拼写错误!

UPDATE orders o, orders_total_couponz otc
SET o.total_paid = o.total_paid - ( otc.converted_value * ( 1 + ( otc.tax_rate / 100 ) ) ),
SET o.total_paid_tax_incl = o.total_paid_tax_incl - ( otc.converted_value * ( 1 + ( otc.tax_rate / 100 ) ) ),
SET o.total_paid_tax_excl = o.total_paid_tax_excl - otc.converted_value,
SET o.total_paid_tax_real = o.total_paid_tax_real - ( otc.converted_value * ( 1 + ( otc.tax_rate / 100 ) ) ),
SET o.total_products = o.total_products - otc.converted_value,
SET o.total_products_wt = o.total_products_wt - ( otc.converted_value * ( 1 + ( otc.tax_rate / 100 ) ) )
WHERE o.id_order = otc.orders_id

错误:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET o.total_paid_tax_incl = o.total_paid_tax_incl - ( otc.converted_value * ( 1 ' at line 3 

最佳答案

仅使用一次 set 关键字,并以逗号分隔要设置的值:

UPDATE orders o, orders_total_couponz otc
SET o.total_paid = o.total_paid - ( otc.converted_value * ( 1 + ( otc.tax_rate / 100 ) ) ),
o.total_paid_tax_incl = o.total_paid_tax_incl - ( otc.converted_value * ( 1 + ( otc.tax_rate / 100 ) ) ),
o.total_paid_tax_excl = o.total_paid_tax_excl - otc.converted_value,
o.total_paid_tax_real = o.total_paid_tax_real - ( otc.converted_value * ( 1 + ( otc.tax_rate / 100 ) ) ),
o.total_products = o.total_products - otc.converted_value,
o.total_products_wt = o.total_products_wt - ( otc.converted_value * ( 1 + ( otc.tax_rate / 100 ) ) )
WHERE o.id_order = otc.orders_id

关于mysql - SQL 语法错误。我的语法错误在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31242692/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com