Change Rows into Columns

G

Guest

My query gives me this

Date1 10 9 8 7
Date2 20 10 5 1
Date3 30 25 3 2

I want this

Date1 Date2 Date3
10 20 30
9 10 25
8 5 3
7 1 2

Any suggestions??
 
M

Michel Walsh

With a recordset? use the method GetRows which retrieve data into an array,
and the indices are somehow, "transposed".


See the help file about the GetRows method for more details and examples.



Hoping it may help,
Vanderghast, Access MVP
 
G

Guest

You need to first normalize your data with a union query like:
SELECT DateField, FldA as TheValue, "A" as Fld
FROM query
UNION ALL
SELECT DateField, FldB, "B"
FROM query
UNION ALL
SELECT DateField, FldC, "C"
FROM query
UNION ALL
SELECT DateField, FldD, "D"
FROM query;

Then, create a crosstab that uses Fld as the Row Heading, DateField as the
Column Heading, and Sum(TheValue) as the Value.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top