Quote:
But the result is not correct
Statements like this do not help us to help you. There is actually no result because your sql does not compile - there are insufficient columns in the group by clause. It needs to be
GROUP BY I.ItemID, I.ItemName,I.OPStock, I.OPStockValue
The next problem is that this will give you item names of 'Pen' and 'Pencil' rather than the item names you show in your image. ItemName should not be part of the Inventory table - it should be on the Items table - you need to normalize your data correctly see
Database Normalization in SQL with Examples – SQLServerCentral[
^]
If you need more help with this then see my comment about sample data and expected results actually matching up.