i have table MESSAGES :
holding messages from users conversations
each conversation looks like this:
now i have query which returns me a list of last message ( *last is defined as max timestamps / max message id ) from each conversation
every row in MESSAGES TABLE holds info about one side of conversation who sends message eg. me or other person
when i QUERY I for all conversations i need to know second side of conversation so i need to add to this QUERY II a select / join statement
LEFT JOIN 
 (  SELECT message_conversationId, message_from as message_from2, message_avatar_pic_id as message_avatar_pic_id_from2
    FROM Messages  msg_from
    WHERE message_from <> 'me' COLLATE NOCASE 
    AND user_id == 1
    GROUP BY message_conversationId
  ) not_me ON message_conversationId = not_me.message_conversationId
to have this result:
How to combine those two queries I + II ?
Aucun commentaire:
Enregistrer un commentaire