The above query is in microsoft sql server syntax and i need to translate it over to mysql syntax... If I attempt to run this query i get the following error message from mysql engine:
1093 you can't specify target table 'patacct' for update in FROM clause...
I posted the above query on the official MySQL forum and received a response on how to work around updating the table being selected. The code is as follows:
UPDATE test SET NewAcct =
NewAcct - (SELECT COUNT(*) FROM (SELECT * FROM test) AS t2 WHERE t2.Acct = test.acct AND t2.NewNo < test.NewNo);
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.