Hi Guys,
I am working on a Simple Billing data base. I have tblSale, tblSaleDetails & tblProduct. I am making a query with a group by clause where all the bills falling under defined date range are grouped together on the basis of product code & product description, fields of Quantity, amount and tax are being totaled (SUM clause in Group BY) together. Till this query works fine. Product Code & Product Description lies in tblProduct & Fields of Quantity, Amount and Tax in tblSaleDetails. Sale Date resides in tblSale.
Now I want to Add GrandTotal bill amount to the query and sum it up. As long as tblSaleDetail has one record for tblSale query works fine, but as soon as the number of records in tblSaleDetails increase from 1 (let's say for example 3 records of tblSaleDetails for 1tblSale), the GrandTotal is also gets added thrice. How Can I make the query to add the grand total only once for every BillNumber in date Range.
HOPE I HAVE BEEN ABLE TO EXPLAIN MY PROBLEM.
Awaiting your help and guidance.
Thanks and Regards
Deepak Gupta