You can't specify target table 'sign_header ' for update in FROM clause
在FROM子句中不能指定目标表'sign_header '用于更新
UPDATE sign_header
SET status_code = 'APPROVED'
WHERE
status_code = 'RECEIVED'
AND (
EXISTS (
SELECT
1
FROM
sign_header sh
LEFT JOIN sign_line sl ON sh.number = sl.number
WHERE
sh.status_code = 'RECEIVED'
AND sl.type = 'E'
))
UPDATE sign_header sh,
sign_line sl
SET hsbh.status_code = 'APPROVED'
WHERE
sh.number = sl.number
AND sh.status_code = 'RECEIVED'
AND sl.borrow_type = 'E'