I am trying to write a trigger to remove a certain number of rows when the table hits a limit. This is what I have currently:
IF (SELECT COUNT(rowa) FROM tableA ) > 10
THEN
DELETE FROM table WHERE dateinsert IN (
SELECT * FROM (
SELECT dateinsert FROM tableA ORDER BY dateinsert ASC limit 1
) AS P
)
end if;
pypmyadmin prompt that i have a syntax error.