Hello,I am using this query below to get the highest RecordID from LiveOdds table and join it with DrawNumber table:select dp.Outcometeams, dp.OutComeGameDesc, dp.OutComeGameCode, cte.DrawNumber, cte.EventID, cte.RecordID from DrawProgram as dp left join (SELECT DrawNumber, EventID, MAX(RecordID) as RecordID FROM LiveOdds group by DrawNumber, EventID) as cte on (dp.DrawNumber=cte.DrawNumber and dp.EventID=cte.EventID) ) as summary
The requirement is how can I get the max RecordID and max -1 RecordID? Lets say if the max recordID is 6 then I need to get both RecordID 6 and 5. Is there a way to do it?Best Regards.