Posted on 2007-11-27
I have two tables.
id col1 col2 col3
id col4 col5 col6
I need a trigger on table 2 which would do this
update table3 set col1= (select sum(table2.col5) from table1, table2 where table1.col1=table2.col2) where table1.id=table3.id
It was giving mutation error. So I created another table table4 and updated the table2.id value in there and the trigger into 2 triggers. 1st trigger would populate the table2.id value in table4 and the trigger on table 4 would do the above SQL and update table3. Still I am getting mutation error.
Thanks fro your help.