title: How merge multiple rows into one row?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1067428/combine-multiple-child-rows-into-one-row-mysql">Combine Multiple child rows into one row MYSQL</a>  </p>
  </blockquote>
  
  
  
  <p>I have following table,</p>
  
  <pre><code>count     | inventory_id | resource_id | id
  ---------+-----------+----------------------
  10        | 1            | 1           | 1
  20        | 2            | 1           | 2
  30        | 1            | 2           | 3
  40        | 2            | 2           | 4
  </code></pre>
  
  <p>I want to merge rows where resource_id is equal and also want to give alias for each count according to inventory_id. I need to give alias "Resource 1" for count where inventory_id =1 and "Resource 2" where inventory_id=2</p>
  
  <p>output needed:</p>
  
  <pre><code>Resource 1| Resource 2    |resource_id 
  ---------+-----------+-----------------
  10        | 20            | 1             
  30        | 40            | 2             
  </code></pre>