My collection looks like this

I need to get all those order no’s whose Pick’s SeqNo is Greater than whose Deliver Status. Business rule is these operations happen based on their SeqNo and no Order No should deliver before get picked up.
In given example, i should get Order No 2, because it delivers before it get pickedup.
Thanks
Sounds like you need something like this – I’ve separated out the query parts to make it easier to read: