I have a following table structure
id item_code type qty
1 1011 Purchase 20
2 1011 Purchase 30
3 1011 Sales -2
4 1011 Purchase 10
5 1011 Sales -7
6 1011 Sales -10
7 1011 Purchase 13
8 1011 Purchase 7
how do i join the table such that i can get data in following pattern
qty_p qty_s
20 -2
30 -7
10 -10
13 null
7 null
motive behind is this to get sale and purchase figures in separate column