View Full Version : Ordering a Crosstab Query


D B Lawson
10-17-2001, 01:28 PM
I've got a dynamic crosstab query with the following SQL:

TRANSFORM First(qryOperativeWorkscheduleCrosstabInfoNew.[The Value]) AS [FirstOfThe Value]
SELECT qryOperativeWorkscheduleCrosstabInfoNew.Operative, qryOperativeWorkscheduleCrosstabInfoNew.Trade, qryOperativeWorkscheduleCrosstabInfoNew.ClSurname, First(qryOperativeWorkscheduleCrosstabInfoNew.[Total of Clsurname2]) AS [FirstOfTotal of Clsurname2]
FROM qryOperativeWorkscheduleCrosstabInfoNew
GROUP BY qryOperativeWorkscheduleCrosstabInfoNew.Operative, qryOperativeWorkscheduleCrosstabInfoNew.Trade, qryOperativeWorkscheduleCrosstabInfoNew.ClSurname
PIVOT qryOperativeWorkscheduleCrosstabInfoNew.Heading;

At the moment the results are all over the place. I want to order by WorkDate but if I add it to the crosstab it is effecting the layout of my results (instead of grouping the results by operative it creates a new line for each record) Is there a way of sorting by WorkDate without including it in the Crosstab results? I've tried to sort it in the select query that the crosstab is based on but that's not working either.

[This message has been edited by D B Lawson (edited 10-17-2001).]