Results 1 to 2 of 2

Thread: delete action on mysql bt trigger

  1. #1
    Join Date
    Jul 2003
    Posts
    421

    delete action on mysql bt trigger

    Hi all, I want to what ever I delete on table1 also delete on transaction_log , the connecction with UserId , the following code is not work, I use Mysql 5.0

    delimiter $$
    CREATE TRIGGER DeleteTrigger
    ON tabl1

    FOR delete
    BEGIN
    delete transaction_log from transaction_log,
    deleted where transaction_log.userId=deleted.User.Id;

    END$$
    delimiter ;
    ________
    Og Kush Pictures
    Last edited by sql; 03-06-2011 at 02:10 AM.

  2. #2
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    Try this on your test server.

    delimiter $$
    CREATE TRIGGER DeleteTrigger
    ON tabl1

    FOR delete
    BEGIN
    delete transaction_log from transaction_log,
    deleted where transaction_log.userId=deleted.UserId;

    END$$
    delimiter ;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •