mysql - how to delete from one table where count less than? -
i have 2 tables.
i use query find number of occurences of field 1 table in table
select t.id, t.tag_text, count(*) cnt sms s, template t s.id_template=t.id group t.tag_text order cnt desc
how can delete rows template if occure in sms less 5 times example? mean if count less 5. use mysql.
delete template id in ( select id_template sms group id_template having count(*) < 5 )
Comments
Post a Comment