sort columns in crosstab Q by field not included in query

J

Jesper

Hi all,

I have this crosstab query that is working.

TRANSFORM First(tblAnswers.Answer) AS FirstOfAnswer
SELECT tblAnswers.clientID
FROM tblDataTemp LEFT JOIN tblAnswersON (tblDataTemp.TestNoID =
tblAnswers.TestNoID ) AND (tblDataTemp.SpmID= tblAnswers.SpmID)
GROUP BY tblAnswers.clientID
ORDER BY tblAnswers.clientID, tblDataTemp.varname
PIVOT tblDataTemp.varname;

I have 2 questions:
The columns in the output are sorted alphabetically by "varname".
I'd like to sort them according to another field "ID" which is in
tblDataTemp instead.
Is that possible?

Also - the ouput naturally outputs the data, but is it possible to include
the actual fieldnames (i.e. varname field) in the output.
So that it appears in the output and not just as column names? Perhaps with
some union query? (I'm using this for data export where this would be
useful).

Thanks a lot.

Jesper, Denmark
 
D

Duane Hookom

So, what happens if you add the ID field into the crosstab as a row heading
and sort by it?

I don't understand the 2nd question. Perhaps you should show use some data,
results, and desired results.
 
J

Jesper

So, what happens if you add the ID field into the crosstab as a row
heading and sort by it?

I don't understand the 2nd question. Perhaps you should show use some
data, results, and desired results.

I worked around it and can live withougt now.
Thanks for looking into it.

Jesper F, Denmark
 
Top