(select sum(Amount) from Receipt_NoteDetalisTBL group by Product_Id HAVING Product_Id = 1 ) \ ( select sum(Quantity) from Receipt_NoteDetalisTBL group by Product_Id HAVING Product_Id = 1 )
SELECT SUM(Amount) / SUM(Quantity) AS Result FROM Receipt_NoteDetalisTBL GROUP BY Product_Id HAVING Product_Id = 1
For showing the division of sum(Amount) and sum(Quantity) you can just write it in the SELECT clause. Something like:
sum(Amount)
sum(Quantity)
SELECT
SELECT sum(Amount) / sum(Quantity) AS Result FROM Receipt_NoteDetalisTBL GROUP BY Product_Id HAVING Product_Id = 1
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)