Hi
I have the following code to insert all missing rows (only rows that are actually not in the table):
INSERT INTO myDetailTable(Field1, Field2)
SELECT A.Field1, C.FieldX FROM myMasterTable A
INNER JOIN myThirdTable C
LEFT JOIN myDetailTable E ON E.Id = C.Id AND E.aField = A.aField
WHERE E.Id IS NULL
Here I get the error 1442 (an't update table 'myDetailTable ' in stored function/trigger because it is already used by statement which invoked this stored function/trigger). I have with other tables the same select and there it works. I don't see the reasion. Thanks, Peter
You cannot refer to a table when updating it.
/* my sql does not support this */