select zdoctypes,zdoctypel,count (docregistration.iddoctype) as Total
from tabdoctype, docregistration
where tabdoctype.iddoctype = docregistration.iddoctype
group by zdoctypes, zdoctypel
/