I have a sample table below and a sql statement that I used but I need some help on some certain issue on this.
Based on the table below **I need to get only the last latest results based on MessageIDs that are associated with the UseEmail
of the excluded row**. By using the statement sql below, it will give all the results of one set of records associated with the
MessageID but **all I need is the latest results based on MessageID ordered by Id in Desc order**. For further explanations, look through all the details below. Thanks!

Sql Statement used so far,

```
select  Id,UserEmail,SellerEmail,Messages,UserName,MessageID 
from [MessagesTab] 
where MessageID in
( 
    select  MessageID 
    from [MessagesTab]
    where UserEmail = @useremail
) 
and UserEmail <> @useremail  Order by Id Desc;

```

**Table**

```
 Id      UserEmail                SellerEmail         Messages             UserName       MessageID
 19     ddfgdfjn84@outlook.com    KTV21@outlook.com   Hi!...               Katie          13d6c0c9
 20     KTV21@outlook.com         KTV21@outlook.com   Hello.               Seller's Name  13d6c0c9  
 21     ddfgdfjn84@outlook.com    KTV21@outlook.com   Where are you?       Katie          13d6c0c9  
22     dsffhfg56@gmail.com        KTV21@outlook.com   When will you call?  Jenny          69e37491  
23     KTV21@outlook.com          KTV21@outlook.com   I'll meet you there. Seller's Name  13d6c0c9  
24     KTV21@outlook.com          KTV21@outlook.com    Ok. Let's go.        Seller's Name  69e37491

```

**@useremail = ddfgdfjn84@outlook.com** - It will give a result of 

```
23     KTV21@outlook.com    KTV21@outlook.com      I'll meet you there.    Seller's Name      13d6c0c9
20     KTV21@outlook.com    KTV21@outlook.com      Hello.                  Seller's Name      13d6c0c9

```

but I only need the last latest results based on **MessageID** which is ordered by **Id** in **desc** order like this below

```
23     KTV21@outlook.com    KTV21@outlook.com      I'll meet you there.    Seller's Name      13d6c0c9

```

same as **@useremail = KTV21@outlook.com** - It will give a result of 

```
22      dsffhfg56@gmail.com     KTV21@outlook.com     When will you call?   Jenny       69e37491
21      ddfgdfjn84@outlook.com  KTV21@outlook.com     Where are you?        Katie       13d6c0c9
19      ddfgdfjn84@outlook.com  KTV21@outlook.com     Hi!...                Katie       13d6c0c9

```

but I only need the last latest results based on **MessageID** which is ordered by **Id** in **desc** order like this below

```
22         dsffhfg56@gmail.com   KTV21@outlook.com   When will you call?    Jenny       69e37491
21      ddfgdfjn84@outlook.com   KTV21@outlook.com   Where are you?         Katie       13d6c0c9

```