select count(*) from (select field2,count(field2) from bsgj.table1 group by field,items_id having(count(field2)>1)) as tmp
where field2=4
having count group by
原文:http://www.cnblogs.com/walter371/p/4736998.html