复杂些的MySQL的Update更新语句
程序员文章站
2022-03-03 19:51:07
...
以下是关联更新表字段,慎用
UPDATE test_info ti
JOIN (
SELECT
al.unit_price_tax,
al.amount,
al.unit_price_tax * apll.amount AS line_amount,
al.line_id
FROM
ac_line al
JOIN test_info ti ON ti.line_id = al.ledger_id
) AS ap ON ap.line_id = ti.line_id
SET ti.line_amount = ap.line_amount
下一篇: 数据库补充