title: SQL group table values
body: <p>So I have an SQL query which consists of a select, multiple subquerys, multiple joins and some where conditions. It looks something like:</p>
  
  <pre><code>SELECT concat(t1.name, ' ', t1.surname) AS users,
  (SELECT t3.value AS col1 WHERE t6.id=343),
  (SELECT t3.value AS col2 WHERE t6.id=344),
  (SELECT t3.value AS col3 WHERE t6.id=345),
  (SELECT t3.value AS col4 WHERE t6.id=346),
  (SELECT t3.value AS col5 WHERE t6.id=347),
  (SELECT t3.value AS col6 WHERE t6.id=348),
  (SELECT t3.value AS col7 WHERE t6.id=349),
  (SELECT t3.value AS col8 WHERE t6.id=350),
  (SELECT t3.value AS col9 WHERE t6.id=351)
  FROM table1 t1
  JOIN table2 t2
  ON t2.id_table1_user=t1.id
  JOIN table3 t3
  ON t2.id=t3.id_eva
  JOIN table4 t4
  ON t3.id_pro_q=t4.id
  JOIN table5 t5
  ON t4.id_pro=t5.id
  JOIN table6 t6
  ON t4.id_t6=t6.id
  JOIN table7 t7
  ON t7.id_table1_user=t1.id
  WHERE t5.id=151
  </code></pre>
  
  <p>It gives me this table:</p>
  
  <p><img src="https://i.stack.imgur.com/QrKLI.png" alt="table 1"></p>
  
  <p>Now... my question is - how can I group the rows so that there are only 2 rows and no NULLs? Is there a way?</p>
  
  <p>Just to note - I am a total SQL beginner, so any suggestions on improving the command or anything are very welcome.</p>