Ver originalselect c,count(*)from(select category_id cfrom item where category_id != 0 and qty >0order by price ASClimit 0,16) tgroup by c