Jump to content
php.lv forumi

mysql un triggeri


DIVX5

Recommended Posts

Palidziet ludzu!

Kas ir par problemu, ka man neizdodas izveidot triggeri mysql.

 

Rakstu query:

CREATE TRIGGER izmaksas BEFORE INSERT ON finanses

FOR EACH

ROW

BEGIN

UPDATE KAMAND_INFO SET IZMAKSAS = NEW.ID WHERE id = NEW.USER_ID;

END ;

----------------------------------------------------

Sanemu atpakal :

SQL vaicājums :

 

CREATE TRIGGER izmaksas BEFORE INSERT ON finanses

FOR EACH

ROW

BEGIN

UPDATE KAMAND_INFO SET IZMAKSAS = NEW.ID WHERE id = NEW.USER_ID

 

MySQL teica:

 

 

#1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'TRIGGER izmaksas BEFORE INSERT ON finanses

FOR EACH

ROW

BE

--------------------------------------------------------------

 

Ir divas tabulas :

finanses(id int ,user_id int ,utt)

komand_info(id int ,izmaksas int, utt)

 

Kad tiek ierakstits ieraksts tabula "finanses", nepieciesams veikt UPDATE "komand_info" tabulas laukam "izmaksas", kur šim laukam jāsaņem "finanses" tabulas "id" lauka vērtība WHERE "finanses" tabulas lauiks "user_ir" = "id" lauku no "komand_info" tabulas.

Link to comment
Share on other sites

×
×
  • Create New...