Click here to Skip to main content
15,904,416 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SELECT     Product.Name, SUM(Product.Quantity) AS Balance, SUM(Income.IncomeQuantity) AS income, SUM(ProductLog.Quantity) as sold
    FROM         Income INNER JOIN
                          Product ON Income.ProductID = Product.ID INNER JOIN
                          ProductLog ON Product.ID = ProductLog.ProductID GROUP BY Name

This query does not works correctly. In product table and income is three rows and this query returns only two because productLog table contains data only two products. how i can select if productLog or income does not contains current product id return 0

see screenshot[^]

1 solution

Share this answer
lester555 7-Aug-11 17:32pm    
thanks man :D

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900