php – MySQL group query doesn't output anything-ThrowExceptions

Exception or error:

I am trying to group a select, but my simple query won’t work. I can not verify what I am doing wrong…

My table messages looks like this:

id | reciever_id | sender_id  |  note    | conversation_id | created
27       12            45       i will        1              (datetime)
26       12            25       hi            2              (datetime)
25       60            12       hey mate      3              (datetime)
24       25            12       hello         2              (datetime)
23       45            12       check it      1              (datetime)
22       12            60       hi            3              (datetime)

My Query:

$messagedata = mysqli_query($con,"SELECT * FROM 'messages' GROUP BY 'conversation_id'");

Wished Output (Only the group’s latest):

id | reciever_id | sender_id  |  note    | conversation_id | created
27       12            45       i will        1              (datetime)
26       12            25       hi            2              (datetime)
25       60            12       hey mate      3              (datetime)

Output: Nothing…

Where’s the problem?

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *