Sorting down to one per message

I’m having issues figuring out how to accomplish this rather simple task

Assuming that entries into MYSQL would be newest last:

| user1 || user2 || message || msgsent |
| me | you | msg | date |
| you | me | msg | date |
| me | you | msg | date |
| me | you | msg | date |
| them | me | msg | date |
| me | them | msg | date | **should select this one
| me | you | msg | date |
| them | you | msg | date |
| you | them | msg | date |
| you | me | msg | date | **should select this one
| me | her | msg | date |
| her | me | msg | date |
| me | her | msg | date |
| me | her | msg | date | **should select this one

2 msgs between me and them.
2 msgs between you and them.
6 msgs between me and you.
4 msgs between me and her.

Get only the latest message between (me & you) and (me & them) and (me & her).

Sponsor our Newsletter | Privacy Policy | Terms of Service