-
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.
-
What do you need? Is it on sql server?
-
i have store procedure
{code}
CREATE PROCEDURE dropStudent()
BEGIN
delete from Post
where(Date(Current_Date)-Date(AccessTime))>=8
{/code}
and UserId in( select UserId from ApplyStatus where ReceiveAll=false);
I want some information get insert into my transaction_log table
________
OG KUSH
Last edited by sql; 03-06-2011 at 02:09 AM.
-
sql server? oracle? sybase? informix? DB2?
-
I use mysql 5.6
________
Buy easy vape
Last edited by sql; 03-06-2011 at 02:09 AM.
-
Can you post some sample data? What to delete and what to log?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|