Link to home
Start Free TrialLog in
Avatar of drhamel69
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
ASKER CERTIFIED SOLUTION
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of drhamel69
drhamel69

ASKER

Excellent!