return CharacterWalletJournal::select('first_party_id', 'second_party_id', 'ref_type', 'category', 'entity_id as party_id', 'name as party_name', DB::raw('count(*) as total'),
            DB::raw("
                CASE 
                    when universe_names.category = 'character' then 
                        (SELECT corporation_id FROM character_affiliations WHERE character_id = universe_names.entity_id)