sql trigger inserting row into two tables
Posted
by
allen
on Stack Overflow
See other posts from Stack Overflow
or by allen
Published on 2010-12-23T20:42:48Z
Indexed on
2010/12/23
20:54 UTC
Read the original article
Hit count: 176
sql
I was looking for a way to create a trigger that would insert the same row into two tables with the same values.
For example, a new row is inserted into pushNotificationQueue as soon as that is inserted, I would like that same exact row to be inserted into messages.
I tried this
CREATE TRIGGER add_to_messages
after insert on mbb_pushNotificationQueue
FOR EACH ROW
insert into mbb_messages select * from mbb_pushNotificationQueue
the only problem with that is that it goes through and adds entries that have already been previously added.
© Stack Overflow or respective owner