尝试这个:
UPDATE customer_orders
SET final_id = MT.MaxId + 1 -- use the computed max id, and increment
, status = 2
, payment_id = '{$transaction_id}'
, payment_type = '{$type}'
, payment_reserved = '{$amount}'
, payment_currency = '{$cur}'
, payment_cardnopostfix = '{$postfix}'
, payment_fraud_suspicious = '{$fraud}'
FROM customer_orders
-- include a subquery to determine the max id from the customer_orders table
-- and assign 'MT' as the name of the results table
, (SELECT MAX(final_id) as MaxId FROM customer_orders) MT
WHERE id = '{$order_id}'