select count(projects.projectid) as c, indcatid , projects.projectid from projects , projectindcats where projects.projectid!=0 and projects.visibility=1 and projectindcats.projectid=projects.projectid group by indcatid order by indcatid
select count(results.projectid) as c, results.appcatid from (select count(projects.projectid) as c, appcatid , projects.projectid from projects , image_tags where projects.projectid!=0 and projects.visibility=1 and image_tags.projectid=projects.projectid group by appcatid , projects.projectid) as results group by results.appcatid order by appcatid