我在插入后写入触发器工作并检查计数记录是否超过500,删除一条记录但不能正常工作 此处代码
CREATE TRIGGER `delrecord` after insert on `tbl_coins`
FOR EACH ROW
BEGIN
DECLARE recordcount INT;
DECLARE deleterecordcount INT;
set recordcount = (select count(*) from tbl_coins);
if recordcount > 500
then
set deleterecordcount = (select ID from tbl_coins order by time asc limit 1);
delete from tbl_coins
where ID = deleterecordcount;
end if;
END
非常感谢