chat - SQL Duplicate result messages -


i have sql query:

select      m.message_subject, m.message_message, m.message_smileys,      m.message_datestamp, u.user_id, u.user_name, u.user_avatar      ".db_messages." m left join     (select           user_id, user_name, user_avatar       ".db_users."       group user_id) u on m.message_from = u.user_id      (message_to='".$userdata['user_id']."'       , message_from = '108')     or (message_to = '108'          , message_from='".$userdata['user_id']."') order      message_datestamp 

result:

result image

what need:

needed result image

database: prntscr.com/9vm1s4

example:
me: hello 12:10
he: hi 12:20am
he: have ? 12:22am
me: fine 1:10pm

any advice?

well thank you

try add group m.message_from before order by part


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -