I don't want to see a stock of products that are empty. I can't figure out my mistake " where condition". Thanks in advance for the solution.
select a.Company_Name as Company, a.Product_name as product, stock =ISNULL( a.qty,0) - isnull(b.qty, 0)-isnull(c.Qty,0) from ( select Company_Name, Product_name, qty = sum(Qty) from tbl_purchase group by Company_Name, Product_name ) a left join (select Company_Name, Product_name,qty = sum(qty) from tbl_sales group by Company_Name, Product_name ) b on a.Company_Name = b.Company_name and a.Product_name = b.Product_name left join ( select Company_Name,Product_Name,Qty=sum(Damage_Qty) from tbl_damage group by Company_Name, Product_name ) c on a.Company_Name=c.Company_Name and a.Product_Name=c.Product_Name <pre> where stcok <> 0
where stcok <> 0
WHERE ISNULL( a.qty,0) - isnull(b.qty, 0)-isnull(c.Qty,0) <> 0
stock =ISNULL( a.qty,0) - isnull(b.qty, 0)-isnull(c.Qty,0) ... where stcok <> 0 /* You have a spelling error here. */
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)