> 
> **Possible Duplicate:**  
> 
> [Combine Multiple child rows into one row MYSQL](https://stackoverflow.com/questions/1067428/combine-multiple-child-rows-into-one-row-mysql) 
> 
> 
> 

I have following table,

```
count     | inventory_id | resource_id | id
---------+-----------+----------------------
10        | 1            | 1           | 1
20        | 2            | 1           | 2
30        | 1            | 2           | 3
40        | 2            | 2           | 4

```

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

output needed:

```
Resource 1| Resource 2    |resource_id 
---------+-----------+-----------------
10        | 20            | 1             
30        | 40            | 2             

```