I am trying to create trigger that ensures that the same shop_id should not repeat more than 3 times, and if user tries to add more than 3 records for the same shop_id, it will throw an error message.
I have written the following trigger but its giving me error message.
IF
(sum(distinct(shop_id)) >3 )
SET MESSAGE_TEXT := 'You cannot insert more than 3 Records';
END IF;
Its giving me following error message.
MySQL said: #1064 - You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version
for the right syntax to use near 'SET MESSAGE_TEXT
:= 'check constraint on
Kindly check this and guide me what i am doing wrong here.
