String queryFields = 'Id, AccountId, ContactId, type';
List<Case> cases = Database.query('select '+ queryFields +' from Case');
for(Case c: cases){
System.debug(c.AccountId);
}
Instead of account id here I want account name. I don't want to do query in for loop for each case. is there a way I can make user of AccountId reference to get account name ?