Revert from a crosstab to a normal Table

I

Ian

I have a table which is in the form of a cross tab in the form:

heading0 1 2 3 4
record1 a b c d
record2 a2 b2 c2 d2

and I want to convert it to:

heading0 Value
record1 a1
record1 b1
record1 c1
record1 d1
record2 a2

It is basically the opposite of a crosstab. Is it possible to do this as a
querries with using visual basic. I am using visual basic right now but it is
very slow.

Any ideas?

Thanks
 
D

Duane Hookom

Your samples are not consistent since a1 is a value anywhere in the first
sample.

You should be able to use a union query:
SELECT Heading0, [1] as Value
FROM tablewithnoname
UNION ALL
SELECT Heading0, [2]
FROM tablewithnoname
UNION ALL
SELECT Heading0, [3]
FROM tablewithnoname
UNION ALL
 

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