Count

Toujours mettre des parenthése pour le count

count le nombre de comid egal a 151301
select count (comid) from objcategory,company where objcategory.objid=company.objid and objcategory.catidclassify=300001 and comid=151301

count le nombre de comid distinct et ordonne par nombre de comid en "double"
le distinct va avec le group by
select distinct comid, count (comid) from objcategory,company where objcategory.objid=company.objid and objcategory.catidclassify=300001 and catid=19101 group by comid order by 2 desc

pour les comid ayant plusieur tuple
select distinct comid, count (comid) from objcategory,company where objcategory.objid=company.objid and objcategory.catidclassify=300001 group by comid having (count(comid)>1) order by 2 desc
select distinct comid, count (comid),catid from objcategory,company where (comactive ='1') AND objcategory.objid=company.objid and objcategory.catidclassify=300001 group by comid ,catid having (count(comid)>1) order by 2 desc

pour les comid dans la liste precedente
select comid,comname,catid from objcategory,company where comid in (467801,376301,455001,1050401,444001,3561723,3868323,4430323,4858823) and (comactive ='1') AND objcategory.objid=company.objid and objcategory.catidclassify=300001
select comid,comname,catid from objcategory,company where comid in (select distinct comid from objcategory,company where (comactive ='1') AND objcategory.objid=company.objid and objcategory.catidclassify=300001 group by comid having (count(comid)>1)) and (comactive ='1') AND objcategory.objid=company.objid and objcategory.catidclassify=300001
select distinct comid,count (distinct(catid)),catid,comname from objcategory,company where comid in (select distinct comid from objcategory,company where objcategory.objid=company.objid and objcategory.catidclassify=300001 group by comid having (count(comid)>1)) AND objcategory.objid=company.objid and objcategory.catidclassify=300001 group by comid ,catid,comname order by 2 asc