Sort on results of crosstab query (1 Viewer)

aldeb

Registered User.
Local time
Today, 15:12
Joined
Dec 23, 2004
Messages
318
Below is the code to my crosstab query. I want to sort
descending) on the GrandTotal. I can apply a sort on the
results of the query but cannot sort in the query. It is
my understanding that this is due to this being a crosstab
query. Has anyone any advice on how I can somehow
automatically descend sort on the GrandTotal Column?
Code:
PARAMETERS [Forms]![Queries_ReportsFRM]![StartDateTxt] DateTime, [Forms]![Queries_ReportsFRM]![EndDateTxt] DateTime, [Forms]![Queries_ReportsFRM].[FaultCategory] Text ( 255 ), [Forms]![Queries_ReportsFRM].[SystemGroupProblem] Text ( 255 );
TRANSFORM Val(Nz(Sum([Totals]),0)) AS SumOfTotals
SELECT [Trends-1-3TON-WEEK].SystemGroup, [Trends-1-3TON-WEEK].FaultCategory, [Trends-1-3TON-WEEK].Problem, Sum([Trends-1-3TON-WEEK].Totals) AS GrandTotal
FROM [Trends-1-3TON-WEEK]
GROUP BY [Trends-1-3TON-WEEK].SystemGroup, [Trends-1-3TON-WEEK].FaultCategory, [Trends-1-3TON-WEEK].Problem
PIVOT [Trends-1-3TON-WEEK].YearMonthWeek;
 

namliam

The Mailman - AWF VIP
Local time
Today, 21:12
Joined
Aug 11, 2003
Messages
11,695
I solved it by making a query on top of the Crosstab... This new query can then be sorted in any which way you like.
 

aldeb

Registered User.
Local time
Today, 15:12
Joined
Dec 23, 2004
Messages
318
This is working for me. Thanks!

Code:
SELECT [Trends-1-3TON_Crosstab-WEEK].*
FROM [Trends-1-3TON_Crosstab-WEEK]
ORDER BY [Trends-1-3TON_Crosstab-WEEK].GrandTotal DESC;
 

Users who are viewing this thread

Top Bottom