get only last record based on ids : <p>I am building chat app and I want to display only last record as per users
Like I have sent 1000s message but I have only chatted with 10 people then I need to get the name of 10 people and last message whether they sent me or I sent them at last</p>

<p><a href="https://i.stack.imgur.com/Eafex.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Eafex.png" alt="enter image description here"></a></p>

<p>Please see above table and give me solution like I want to get only one record from the last two records. </p>
