Getting first or last element of a collection

Get the most recent comment of Userstory from Task

We can get the most recent comment in an entity with the help of the First keyword.

api/v2/Task?Select={Id,Name,Effort,Description,RecentComment:UserStory.Comments.Select
({CreateDate,Owner,Description}).First}&where=(UserStory.Id=191083)

So here the output we receive is the recent comment of the userstory with ID 191083.

Get the oldest comment of Userstory from Task

We do not have a direct keyword to get the oldest comment of an entity. Instead, we order the comments in ascending order of their CreateDate and fetch the first comment from the list which is nothing but the oldest comment of an entity.

/api/v2/Task?Select={Id,Name,Effort,Description,OldestComment:UserStory.Comments.Select
({CreateDate,Owner,Description}).OrderBy(CreateDate).First}&where=(UserStory.Id=191083)