1. You can't specify target table 't_ams_ac_if' for update in FROM clause

    原SQL:

UPDATE t_a

SET  c_a='B'
WHERE c_id=(
     SELECT c_id
     FROM t_a
     WHERE c_a = 'A'
);

    原因:从原表中查出数据不能直接修改

    修改方法:将子查询出的结果放置到临时表中再修改原表

UPDATE t_a

SET  c_a='B'
WHERE c_id=(
   SELECT a.c_id FROM (
     SELECT c_id
     FROM t_a
     WHERE c_a = 'A'
   ) a
);

2.You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'a WHERE c_id=1' at line

    原SQL:

DELETE FROM t_a a WHERE c_id=1;

    原因:

    修改方法:当给欲删除数据的表起别名后需要在DELETE FROM语句之间显式声明表别名

DELETE a FROM t_a a WHERE c_id=1;