You Need the tables, GeneralJournalAccountEntry, MainAccount, and MainAccountCategory, the joins are straight Forward.
MainAccountAccountCategoryRef == MainAccountCategory.AccountCategoryRef
The AccountType field in MainAccountCategory is most likely what you are looking for.