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

Popular posts from this blog

sql - can we replace full join with union of left and right join? why not? -

javascript - Parallax scrolling and fixed footer code causing width issues -

iOS: Performance of reloading UIImage(name:...) -