title: Concat sql sum in MySQL
body: <p>Is there any way to use the <code>sum</code> yield in <code>group_concat</code> or any work around?</p>
  
  <p>I have the following query, which returns redundant results for for <code>item_id</code> and <code>items.title</code> fields:</p>
  
  <pre><code>SELECT
    item_id, sum(qty), items.title, units.title
    FROM invoice_items
    LEFT JOIN items
     ON item_id = items.id
      LEFT JOIN units ON invoice_items.unit_id = units.id
   GROUP BY item_id, invoice_items.unit_id ORDER BY items.id, units.weight DESC;
  </code></pre>
  
  <p>I tried to use <code>group_concat</code> to concat redundant rows as follows:</p>
  
  <pre><code>SELECT
  sum(qty),  group_concat(item_id, items.title, sum(qty) SEPARATOR '-')
    FROM invoice_items
    LEFT JOIN items
     ON item_id = items.id
      LEFT JOIN units ON invoice_items.unit_id = units.id
   GROUP BY item_id, invoice_items.unit_id ORDER BY items.id, units.weight DESC;
  </code></pre>
  
  <p>However, it returns this error: <code>Invalid use of group function</code> </p>
  
  <p>What I want is to concatenate the <code>sum</code> yield in one row regard less of any other fields.</p>
  
  <p>The following is a screen shot for the query result:</p>
  
  <p><a href="https://i.stack.imgur.com/SVL7u.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SVL7u.png" alt="enter image description here"></a></p>
  
  <p>I need first row to be something like:</p>
  
  <pre><code>item_id: 1
  sum(qty): 2, 13, 5
  title: اسبوسيد أقراص
  </code></pre>