I am running a query with the code below. The intent of this query is to get a count by LoanType, LoanTypeINCDE, and LoanTypeDescription. However, it is returning several totals for each.
How do I just get a count for each of the loan types? Thanks.
Purchase_Count_2019 = (Select Sum(Case When ah.TransactionType='DPA' Then 1 Else 0 End) From AccountHistory ah Where ah.MemberNumber=ln.MemberNumber AND ah.AccountNumber=ln.LoanNumber AND ah.EntryDate Between '11/01/2019' AND '11/30/2019')
Join LoanTypeDefinitions ltd
ln.LoanType In ('5','8','34','55','69','89','97','99','103','104','105','108')