The Script below counts all the credit lines used for each invoice type. J = Job, S = Service, C = Cycle, and O = Other
select b.Type_JSCO as TYPE_JSCO,
count(b.type_jsco) as [Number of Credits by Type]
from ar_customer a, ar_credit b
where a.customer_id=b.customer_id
and a.customer_id<>1
group by b.Type_JSCO