search

Home  >  Q&A  >  body text

mysql trigger

Mysql trigger problem, I want to delete the content of an article and the comments about this article in another table will also be deleted at the same time. How to write this?

delimiter //

create trigger tr_cno before delete on wenzhnag for each row

begin

delete from choose where content= old.content;

end;

//

delimiter ;

delete from pinglun where content='';

i It was originally written like this but I keep getting errors

Please tell me how to write this

Y.AY.A2379 days ago1385

reply all(1)I'll reply

  • 秋香姐家的小书童

    秋香姐家的小书童2018-06-21 11:27:47

    This operation does not require MYSQL. It is written in PHP. Just query the comments under the article and then delete the article and comments at the same time.

    reply
    0
  • Y.A

    This is a necessary trigger for our job

    Y.A · 2018-06-21 11:28:42
    Y.A

    If you reply, can you give me some advice?

    Y.A · 2018-06-21 11:29:14
  • Cancelreply