Compare aggregate record between row and column

How can a value in one row be compared to the value in a different row and column?

Example: Compare DateTimeEnd for ID 18 to DateTimeStart for ID 19.



Don't know how to do that in the aggregate, but you could do a foreach over the aggregate result and do the compare.



Can you say more about the use case? If there is a case where you can give the IDs of the rows you want to compare as inputs, you could do a join on the table (PatientMonitor101DT to PatientMonitor101DT) and then you would have both records being returned and available for comparison.

Hi Glenn, can you do a join with the same entity (PatientMonitor101DT) as entity2 have another attribute as an order , and filter your query with something like:

<your date comparison with  entity1.StartDate and entity2.Endate>  and (entity1.order = entity2.order+1) and (entity1.order >=1)

try to warrant that order is unique and sequential with logic on your CRUDS