drhamel69
asked on
How to add mysql insert trigger
I need to create a a record in tblOrderStatus everytime a record is INSERTED in tblOrders. I have a bit so far but my big question is how do I insert the tblOrder.id into tblOrderStatus with my trigger?
DELIMITER $$
CREATE TRIGGER after_orderPlaced
AFTER INSERT ON tblOrders
FOR EACH ROW
BEGIN
INSERT INTO tblStatus
SET tblLastTime = ADDTIME(Curtime(),'2:00:00 '),
tblLastDate = Curdate()
tblOrderId = ??????????????
END
DELIMITER $$
CREATE TRIGGER after_orderPlaced
AFTER INSERT ON tblOrders
FOR EACH ROW
BEGIN
INSERT INTO tblStatus
SET tblLastTime = ADDTIME(Curtime(),'2:00:00
tblLastDate = Curdate()
tblOrderId = ??????????????
END
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER