-
Problem with aggregate query
Hi and a happy and prosperous new year to everyone out there.I would want someone to help me out of this riddle:
There is an application am developing in which I have customers and their various orders.The Customer Table (Customers) is related to the Orders Table(Orders) by a field (CustNo).At the VB front end I created a MASTER/DETAIL Relationship for the two tables(Customer table is Master while Orders table is Detail).The following is the code that is intended to sum all charges on the Orders table relating to a customer:
“SELECT Customer.Date,Customer.CustNo,Customer.Address,Orders.CustNo,SUM(Orders.Labour) AS Labour Charges,SUM(Orders.VAT) AS VAT Charges,SUM(Orders.Misc) AS Miscellaneuos Charges FROM Customer INNER JOIN Orders ON Customer.CustNo=Orders.CustNo GROUP BY Customer.Date,Customer.CustNo,Customer.Address,Orders.CustNo”
Problem is, using this query I don’t get the desired result.For instance,when a customer has multiple orders, I should get the total for each of the charges displayed but what I get instead is a report that presents different pages for each order placed by same customer instead of having it displayed and totaled on a single page.Anyway around this from anyone please?
Similar Threads
-
By Vick in forum Database
Replies: 2
Last Post: 12-05-2002, 02:01 PM
-
By Cristhian in forum VB Classic
Replies: 1
Last Post: 05-01-2002, 03:55 PM
-
By Drew Curry in forum Database
Replies: 0
Last Post: 06-26-2001, 01:47 PM
-
By Jarren in forum VB Classic
Replies: 1
Last Post: 01-29-2001, 03:04 PM
-
By Bragi Fannar in forum VB Classic
Replies: 1
Last Post: 11-04-2000, 05:42 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks