-2

I have got two tables - Conversations and Messages, each conversation has many messages. We have to find the latest message for each Conversation.

ER-Diagram

I have tried join and "group by converstion_id" but it provides me the oldest messages.

Help me out with SQL query with respect to the MySQL.

  • 1
    Hi. This is a faq. (Obviously). See the downvote arrow mouseover text. When you do ask, because it's not a duplicate, please act on [mcve]. Please use text, not images/links, for text. Act on hits googling 'stackexchange homework'. [Why is β€œCan someone help me?” not an actual question?](https://meta.stackoverflow.com/q/284236/3404097) – philipxy Oct 19 '18 at 14:55
  • Add sample table data and the expected result - all as formatted text, not images. Also show us your current query attempt. – jarlh Oct 19 '18 at 14:58

1 Answers1

-1

The underlying problem here is that you want to order the data you'are grouping on before the GROUP BY is executed. This question is asked, and answered, before.

MySQL order by before group by

ABos
  • 56
  • 1
  • 1
  • 7