Could anyone tell me what is wrong with this and why I am getting the error #1248 – Every derived table must have its own alias. ?
UPDATE (SELECT t.crime_definition p1, s.crime_definition p2
FROM crime_2007 t, crime_2010 s
WHERE crime_2007.crime_id_2007 = crime_2010.crime_id)
SET p1 = p2
I have researched for a long time and I can’t pin point the problem. I am trying to copy a column from one table to a column in a different table.
thank you in advance!
The “derived” table is the SELECT between parenthesis. You can (and should in your case) give it a (short-lived) name.
But the above will not work either (at least in MYSQL) as it will tell you that “The target table dummyName is not updateable”.
You can use this which should work in many systems as it’s standard ANSI SQL:
Many systems use “non-standard” SQL, like Lamak’s answer for SQL-Server and this that will work in MYSQL only: