SQL语法错误。我的合成错误在哪里?

时间:2015-07-06 09:51:11

标签: mysql syntax

我不能为我的生活发现我的错字!

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 

2 个答案:

答案 0 :(得分:1)

仅使用Severity Code Description Project File Line Error LNK1120 1 unresolved externals hello_world C:\Users\S_KW\OpenCL\hello_world\bin\hello_world.exe 1 Error LNK2001 unresolved external symbol __imp_sprintf hello_world C:\Users\S_KW\OpenCL\hello_world\OpenCL.lib(icd_windows.obj) 1 Warning LNK4044 unrecognized option '/LC:\Users\S_KW\arrow_c5sockit_bsp\arm32\lib'; ignored hello_world C:\Users\S_KW\OpenCL\hello_world\LINK 1 Warning LNK4044 unrecognized option '/lalterahalmmd'; ignored hello_world C:\Users\S_KW\OpenCL\hello_world\LINK 1 Warning LNK4044 unrecognized option '/lalterammdpcie'; ignored hello_world C:\Users\S_KW\OpenCL\hello_world\LINK 1 关键字一次,并使用逗号分隔要设置的值:

set

答案 1 :(得分:1)

不要一次又一次地使用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