MySQL Query Syntax Help

admin

Administrator
Staff member
I have the following concern about MySQL Syntax:

I want to "DELETE" the entries with "flag" equals to "1" whenever there's over 5000 records in the table.

I tried to do the following:

DELETE * FROM mytable WHERE (COUNT(*) FROM mytable > 5000) AND (flag=1);

The error I got is:

You have an error in your SQL syntax near '* FROM mytable WHERE (COUNT(*) FROM mytable > 4000) AND (flag=1)'

Can someone help me out with this?
 
Back
Top