MYSQL Update Trigger get updated row ID -


i have table in mysql updating. trigger updated row id work it. how can it? can in sql server, new mysql , couldn't find online.

update...

so can't share code, want want do.

table:  **id** **product** **price** 1,     coke,         2.05 usd  2,     sprite,       2.00 usd 3,     7up,          2.10 usd 

i want update id 2, "sprite" price 2.50 usd. normally, need run trigger update audit table. audit table need register id of product. need know updated row's id 2...

is there similar in sql?

you can refer id column using either new.id or old.id long id column not change.

generally spoken, alias new can current value of updated column , old obtain value column had before update performed.

create trigger au_product_table     after update on product_table     each row     update audit         set product_id = new.id         your_condition; 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -