Join query with aggrigation function
Hi
I have 3 tables ProductExpiryProcess, ProdcutCompanyName, ProductDetail
ProductExpiryProcess table contains expiry process(which tells when product expire) and data like
ProductExpiryProcessId processStartDate processEndDate
1 2011/09/10 2011/09/11
2 2011/08/10 2011/08/11
3 2011/07/10 2011/07/11
ProdcutCompanyName table contains Product's company name and ProductExpiryProcessId and data like
ProdcutCompanyNameId ProductExpiryProcessId ExpiryDate
1 1 2011/09/10
2 1 2011/09/10
3 2 2011/08/10
ProductDetail table contains Price of product and data like
ProdcutCompanyNameId ProductExpiryProcessId ProductPrice
1 1 200
2 1 400
3 2 800
I want to gnerate output like
Month NoOfProductsExpired SumOfProductsPrice
09/2011 2 600
08/2011 1 800
Thanks