order_placed(order_no,mess_id,...)费率(mess_id,student_id,rating)
我想创建一个触发器,用于在下订单时检查混乱的评级是否小于4,如果是,则无法下达订单。
CREATE TRIGGER new_order
AFTER INSERT ON order_placed
FOR EACH NEW ROW
BEGIN
IF((SELECT AVG(rating) FROM rates WHERE rates.mess_id = NEW.mess_id) < 4)
ROLLBACK TRAN
END;
我收到ERROR 1064
。