I don't believe this is possible other then doing a nested query but I wanted to double check with everyone in case I was missing the boat.

SELECT Id, CommentBody, CreatedDate, ParentId, CreatedById FROM CaseComments WHERE AccountId = :strAccountId ORDER BY ParentId, CreatedDate DESC

AccountId is obviously not a field on CaseComments so I can not do this. How would I walk CaseComments back to Account?

1 Answer 1


You can do something like the following:

SELECT Id, CommentBody, CreatedDate, ParentId, Parent.AccountId FROM CaseComment

Where Parent.AccountId would give you the AccountId from the Case.

  • That will do a better job :) Commented Apr 21, 2017 at 20:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .