Results 1 to 6 of 6

Thread: triggle after and before problem

Threaded View

  1. #1
    Join Date
    Jul 2003
    Posts
    421

    triggle after and before problem

    I have triggle
    {code}
    CREATE TRIGGER myTrigger
    after DELETE ON Post
    FOR EACH ROW
    BEGIN
    INSERT into transaction_log(userId,UniversityN, EnglishName,ChineseName, AccessTime)
    select UserId, UniversityN,EnglishName, ChineseName, AccessTime from Post
    where (Date(Current_Date)-Date(AccessTime))>=8
    and UserId in( select UserId from ApplyStatus where ReceiveAll=false);

    END$$
    {/code}
    if I delete more then one rows on post table and use before on my triggle, I always get duplicate insert on my ransaction_log,
    if I use after in my triggle, I only get one row insert into ransaction_log
    how to deal with this problem??
    Thank y ou
    ________
    Nash Ambassador History
    Last edited by sql; 03-06-2011 at 02:09 AM.

Posting Permissions

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