0

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.

4

0 回答 0