SQL, vertical horizontal

emili0

New member
Local time
Today, 14:04
Joined
Jun 21, 2013
Messages
1
Hi Guys,

My first post here. I have a small table that's something like this;

Code:
Description  CompA  2000A  2001A    2002A   CompB   2000B   2001B   2002B
Income        ABC    111     222     333    DEF      444     555     666
Cash          ABC    777     888     999    DEF      1122    2233    3344
and I want to have something like this as the recordset:

Code:
DescriptionX  CompX  2000X  2001X    2002X   DescriptionY  CompY    2000Y  2001Y    2002Y
Income        ABC    111     222     333      Cash        ABC       777     888      999
Income        DEF    444     555     666      Cash        DEF      1122     2233     3344
I have trawled the internet and tried some SQL manipulations but I am still stuck with this problem. Can you give me some direction please?

Thanks.
 
Table normalization would make it better...

Description / Type / Comp / Year / Value
...
Income / X / ABC / 2000 / 111
Income / X / ABC / 2001 / 222
Income / X / ABC / 2002 / 333

Copy it into excel, transpose and fix your data table.

You could also use a transpose() function in access, but it would probably be faster to fix your data instead.
 

Users who are viewing this thread

Back
Top Bottom