Sunday 15 August 2010

mysql - Update: You can't specify target table 'table' for update in FROM clause -



mysql - Update: You can't specify target table 'table' for update in FROM clause -

i have 2 queries oracle. , need modify them mysql. first query:

update tec_onoff_file set emailtype = 'migr' exists (select 1 tec_onoff_file emailtype = 'migr' , a.acctnbr = acctnbr , a.magabbr = magcodes);

i changed to

update tec_onoff_file t1 bring together tec_onoff_file t2 on t2.emailtype='migr' , t1.acctnbr=t2.acctnbr , t1.magabbr=t2.magcodes set t1.emailtype='migr';

and works. sec query harder me

update tec_onoff_file set emailtype = 'rein' transtype = 'rein' , curracctnbr not in (select curracctnbr tec_onoff_file b emailtype ='renw' , a.curracctnbr=b.curracctnbr);

could help it? i'm trying alter first query join, fails, don't know how it.

update tec_onoff_file left bring together tec_onoff_file n on b.curracctnbr = a.curracctnbr , b.emailtype ='renw' set emailtype = 'rein' a.transtype = 'rein' , b.transtype null;

mysql oracle

No comments:

Post a Comment