how to show all data in this query

grad2009

Registered User.
Local time
Today, 08:13
Joined
Feb 7, 2010
Messages
30
hello guys,
i have a query that shows the balance of each item, here is the query
Code:
SELECT Items.itemNo, Items.itemName, Items.type, Items.unit, Sum(Transactions.qtyIn) AS totalProcurements , Sum(Transactions.qtyOut) AS totalSales,totalProcurements- totalSales AS balance
FROM Items INNER JOIN Transactions ON Items.itemNo=Transactions.ItemNo
GROUP BY Items.itemNo, Items.itemName, Items.type, Items.unit;

when i view data in this query it views only the items that have a value on the totalProcurements field, i want to view all the records even if the totalProcurements is zero.
i hope that you understand what i want
thanks with best regards,
 
Change the inner join to a right join.
 
thanks alot GalaxiomAtHome
i changed the inner join to left join and that was ok, but i still have somethings to ask you, all the records was viewed but there is no value in the totalProcurements field, i want to view 0 value in this field,how can i do this, i set the default value 0 but it is still blank (with no value)
thanks with regards,
 
Last edited:
Change

Sum(Transactions.qtyIn)

To

Sum(Nz(Transactions.qtyIn,0))

David
 
many thanks to you David and GalaxiomAtHome, you helped me alot
my problem now is solved
regards,
 

Users who are viewing this thread

Back
Top Bottom