ID
|
Date
|
Product name
|
Unit
|
Qty
|
1
|
10/10/2017
|
cello
|
pic
|
50
|
2
|
10/10/2017
|
notebook
|
pic
|
30
|
3
|
5/10/2017
|
Rice
|
kg
|
50
|
4
|
5/10/2017
|
Bottel
|
Litter
|
30
|
5
|
5/10/2017
|
notebook
|
pic
|
80
|
6
|
5/10/2017
|
cello
|
pic
|
40
|
Item in Stock
ID
|
Date
|
Product name
|
unit
|
totalQty
|
totalSold
|
StockInHand
|
1
|
10/10/2017
|
cello
|
pic
|
90
|
50
|
40
|
2
|
10/10/2017
|
notebook
|
pic
|
110
|
10
|
100
|
3
|
5/10/2017
|
Rice
|
kg
|
50
|
0
|
50
|
4
|
5/10/2017
|
Bottel
|
Litter
|
30
|
10
|
20
|
How to add two same name item like cello (50+40=90) and notebook (30+80=110)
sum(cast(inv.QTY as numeric(18,2)))+isnull(sum(cast(inv.QTY as numeric(18,2))),0) as totalQty