I have data like 

```
|id|id_barang|in|out|stock|
|1|1|2|0|2|
|2|1|2|0|4|
|3|1|0|1|3|
|4|2|2|0|2|
|5|2|1|0|3|
|6|2|0|1|2|

```

I want result is group by id\_barang

```
|Id_barang|sum(in)|sum(out)|first(stock)|
|1|4|1|2|
|2|3|1|2|

```