[AccessD] Sort order in report

Ervin Brindza viner at eunet.yu
Wed Sep 3 06:25:37 CDT 2003


Hi,
I need a little push to finish my report. I have 3 tables: Customer(Id, Name), Order(Id - the customer's Id, KeyFld - AutoNumber field, linked to the table OrderDet), OrderDet(KeyFld, Id - ordered item's Id, ItemName, Amount)
The record source of the report is:
SELECT CUSTOMER.Id, CUSTOMER.Name, ORDERDET.ItemName, ORDERDET.Id, Sum(ORDERDET.Amount) AS SumOfAmount

FROM CUSTOMER INNER JOIN (ORDER INNER JOIN ORDERDET ON ORDER. KeyFld = ORDERDET.KeyFld) ON CUSTOMER.Id = ORDER.Id

GROUP BY CUSTOMER.Id, CUSTOMER. CustName, ORDERDET.ItemName, ORDERDET.Id;

And I want to list the customers along with their ordered items, but in descending order on the sum of amount they ordered(the ordered items are listed desc and that is ok). In the report's View/Sorting and grouping I put CUSTOMER.Name and SumOfAmount desc and I get customers listed by their name :(

So, my report looks like:

1. Ervin Brindza

    1. orange 100

    2. apple 80

2. Mike Thompson

    1. plum 155

    1. orange 40

but I want Mike Thompson to be listed first(he ordered 195) and after came Ervin Brindza(who ordered 180)

Hope I was clear enough.

Can anyone shed any light please?

TIA,

    Ervin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030903/130636b8/attachment.html>


More information about the AccessD mailing list