title: Alternative to GROUP CONCAT
body: <p>I stumbled upon this issue and can't seem to get the hang of it.
  I have three tables:</p>
  
  <p>MSG_V3_THREAD</p>
  
  <p><img src="https://i.stack.imgur.com/VKVrT.png" alt="enter image description here"></p>
  
  <p>MSG_V3_THREAD_USERS</p>
  
  <p><img src="https://i.stack.imgur.com/wSYhq.png" alt="enter image description here"></p>
  
  <p>MSG_V3_THREAD_PARTNERS</p>
  
  <p><img src="https://i.stack.imgur.com/rWmjE.png" alt="enter image description here"></p>
  
  <p>Now, what I need to do is to get this table in the end:</p>
  
  <p><img src="https://i.stack.imgur.com/d1HQw.jpg" alt="enter image description here"></p>
  
  <p>(NOTE: the above image is photoshopped)</p>
  
  <p>I cannot seem to find a solution to this. I managed to do a <code>group_concat</code> which gives me the correct result but it is not in the format I need. I also have this query at the moment:</p>
  
  <pre><code>SELECT  msg_v3_thread.thread_id, user_id, NULL as partner_id
  FROM msg_v3_thread
  LEFT JOIN msg_v3_thread_users ON msg_v3_thread_users.thread_id = msg_v3_thread.thread_id 
  WHERE msg_v3_thread.thread_id = 3
  UNION
  SELECT  msg_v3_thread.thread_id, partner_id, NULL as user_id
  FROM msg_v3_thread
  LEFT JOIN msg_v3_thread_partners ON msg_v3_thread_partners.thread_id = msg_v3_thread.thread_id 
  WHERE msg_v3_thread.thread_id = 3
  </code></pre>
  
  <p>Which results into this:</p>
  
  <p><img src="https://i.stack.imgur.com/cifYE.png" alt="enter image description here"></p>
  
  <p>It just puts all the ids in one column.</p>
  
  <p>Could anyone please help me with this? It might be that the solution is pretty simple but I just can't see it.</p>
  
  <p>Thank you!</p>