MySQL UPDATE statement using a table created on the fly
Question
I want to update a table, say Table 1
using a table that I create on the fly (saytemp
). To achieve this I have the following query:
UPDATE Table1 SET COUNT = temp.ctemp FROM ( SELECT A, SUM(UNO) AS ctemp FROM Table1
GROUP BY A
ORDER BY A)
AS temp,Table1 t1
WHERE temp.A = t1.A;
It works well in SQL Server 2008
but MySQL
throws out the error
syntax error, unexpected FROM, expecting 'END_OF_INPUT' or ';'
Any idea what I am missing here?
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange