UPDATE a_fees af set af.audit_id = get_audit_id ( pubco_id, auditor_id,
(SELECT
CONCAT ('''',
a_fees.fiscal_year, '',
fiscal_period_end_month,'',
fiscal_period_end_day, '''')
FROM a_fees, a_fiscal_period_end
WHERE a_fees.fiscal_period_end_id = a_fiscal_period_end.fiscal_period_end_id)
);
#1093 - You can't specify target table 'af' for update in FROM clause
答案 0 :(得分:0)
根据this ,这应该有效:
UPDATE a_fees set audit_id = get_audit_id ( pubco_id, auditor_id,
(SELECT
CONCAT ('''',
af.fiscal_year, '',
fiscal_period_end_month,'',
fiscal_period_end_day, '''')
FROM a_fees af, a_fiscal_period_end
WHERE af.fiscal_period_end_id = a_fiscal_period_end.fiscal_period_end_id)
);