Group By and Displaying....

Results 1 to 2 of 2

Thread: Group By and Displaying....

  1. #1
    Join Date
    Dec 1969

    Default Group By and Displaying....

    I have the following Query<BR><BR>SELECT tOrder.OrderID, tOrder.OrderStatusID, tOrder.RequestDate, tOrder.Total, tOrder.SalesPersonID, tAdminLogin.ID, tAdminLogin.RealName, tBillAddress.BillZip, tProspect.ProspectID, tProspect.Contact, tProspect.Contractor, tProspect.Phone FROM (tProspect INNER JOIN ((tAdminLogin RIGHT JOIN tOrder ON tAdminLogin.ID = tOrder.SalesPersonID) INNER JOIN tOrderProspect ON tOrder.OrderID = tOrderProspect.OrderID) ON tProspect.ProspectID = tOrderProspect.ProspectID) INNER JOIN (tBillAddress INNER JOIN (tAddress INNER JOIN tPAddress ON tAddress.AddressID = tPAddress.AddressID) ON tBillAddress.BillAddressID = tPAddress.BillAddressID) ON tProspect.ProspectID = tPAddress.ProspectID WHERE (((tOrder.RequestDate) Between #02/01/2002# And #3/21/2003#)) ORDER BY tOrder.SalesPersonID, tOrder.OrderID,tOrder.RequestDate ASC;<BR><BR>I know its long, but I need a bit of help displaying something. Basically, I want to add up all the orders for a particular tOrder.SalesPersonID, so whe displaying these results, i can append a line with the total of sales for that person. Does make sense? I want to get all orders for everybody and order them by tOrder.SalesPersonID, after all the orders for a particular user display. I want to get the SUM of those orders, and append a line with that information. I know how to do the query...for the most part, its matter of displayiung those records as I loop through them that is confusing...Can anyone help? Thanks<BR><BR>Harry C<BR>

  2. #2
    Join Date
    Dec 1969
    Los Angeles, CA

    Default What is confusing

    Cant you just sum in a variable in the loop and when the ID changes set the variable to 0 and start all over again?<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts