0

更新声明

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
4

1 回答 1

0

据此,应该工作:

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)
);
于 2013-01-10T09:07:22.007 回答