I have a table
DocumentNumber, ItemNumber, Qty,
-----------------------------------
600000001, 1006YL01, 1
100001976, 1006YL01, -1
100008439, 1006YL08, -1
600000001, 1006YL08, 1
100005095, 1006YL08, -1
100003814, 1006YL08, -1
100002955, 1006YL08, -1
500000087, 1006YL08, 2
500000212, 1006YL08, 1
100001152, 1006YL09, -1
100004799, 1006YL09, -1
500000282, 1006YL09, 2
100002859, 1006YL09, -1
600000001, 1006YL09, 2
100003625, 1006YL09, -1
600000001, 1006YL10, 2
100003274, 1006YL10, -1
100002451, 1006YL10, -1
I want to make a query which returns
Document Number, ItemNumber, ReceiveQty (from qty >1), Issue Qty (from qty<1)
Can any body help?