• My query, without chaning anything, works for tie-breakers too as per your rule (highest of cid should be retrieved). Can you give me a perfect set of example to work on? A sample data set that covers all your business rules?