MySQL Forums
Forum List  »  Triggers

Re: trigger with condition
Posted by: Martin Tomczyk
Date: November 29, 2013 02:21PM

Thanks Peter,

I have some questions back:

1. how to check if it refers to it or not? The update I posted is running and updating the mentioned id and I get no errors.
2. Join is missing the joining condition. OK. I need to set it....
but I don't understand your code. The needed id's 1 and 2 are missing so I wonder how it could update correctly? The trigger should "touch" only this two id's.
The purpose is to "sync" one field from one table to the other. exclusively these two id's. one on source the other one on destination. the id's are fix and different in each table. so they do not match and also should not. the id's itself should not be updated only the introtext of these id's.
You mentioned NEW/ OLD regarding trigger. I'm not sure know if understood the manual correctly but there should never be any new rows created. only the one that exists should be updated with content of the other. but only the field introtext...nothing else.

And the trigger should not 2sync" these two id's if antoher source id is edited but only if source.id=1 is changed.

Quote from manual: In an UPDATE trigger, you can use OLD.col_name to refer to the columns of a row before it is updated and NEW.col_name to refer to the columns of the row after it is updated.
Does this mean NEW.col_name is in real my "old"/source field?


I thought that I described it well but I must have missed something. What info do you need to help me out ? :) btw it is mysql 5.0.90 underneath (update planned but I need it running on this version).

Peter, thanks a lot for your help. I really appreciate it. Sorry if I describe things a little bit confusing. I do my best.
Best regards
Martin



Edited 1 time(s). Last edit at 11/29/2013 02:24PM by Martin Tomczyk.

Options: ReplyQuote


Subject
Views
Written By
Posted
2602
November 29, 2013 07:01AM
1308
November 29, 2013 12:27PM
Re: trigger with condition
1280
November 29, 2013 02:21PM
1243
November 30, 2013 04:03PM
1298
November 30, 2013 11:37PM
1160
December 01, 2013 03:52AM
1143
December 01, 2013 01:46PM
1207
December 01, 2013 03:21PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.