I Have three tables - Product, GoodsIn, GoodsOut
Product - ProductID, ProductCode, Description
GoodsIn - GoodsInID, Date, ProductID, Qty
GoodsOut - GoodsOutID, Date, ProductID, Qty
I am trying to create a query that combines the data from these tables to give me a total of goods in and goods out for each product.
This works ok if there is a record for each ProductID in each of the tables.
However if ProductID 1, for example, exists in both the Product and GoodsIn table but does not have a corresponding record in the GoodsOut table then no data is returned for that record.
How can I just return a value of 0 for the quantity if no record for the ProductID exists in either the GoodsIn or GoodsOut tables.
Any help would be appreciated.
jonnyuk3
Product - ProductID, ProductCode, Description
GoodsIn - GoodsInID, Date, ProductID, Qty
GoodsOut - GoodsOutID, Date, ProductID, Qty
I am trying to create a query that combines the data from these tables to give me a total of goods in and goods out for each product.
This works ok if there is a record for each ProductID in each of the tables.
However if ProductID 1, for example, exists in both the Product and GoodsIn table but does not have a corresponding record in the GoodsOut table then no data is returned for that record.
How can I just return a value of 0 for the quantity if no record for the ProductID exists in either the GoodsIn or GoodsOut tables.
Any help would be appreciated.
jonnyuk3