I am trying query a tall table with sql and have the oupt appear as a flat result set for easier reporting.
TALL table is what I have
-------------------------
1 a
2 b
3 a
4 a
5 c
6 d
7 e
8 f
9 g
10 a
FLAT result set is what I desire
---------------------------
1 2 3 4 5 6 7 8 9 10
a b a a c d e f g a
My initital thoughts include:
1) Rebuilding the table into a flat table. However, this will require a major re-work over some application code.
2) Creating a single sql statement and join the table to itself multiple times. I need to select 45 columns, so this would be a huge query. It would be a pain to write and may be even more painful to execute.
Any Ideas?
TALL table is what I have
-------------------------
1 a
2 b
3 a
4 a
5 c
6 d
7 e
8 f
9 g
10 a
FLAT result set is what I desire
---------------------------
1 2 3 4 5 6 7 8 9 10
a b a a c d e f g a
My initital thoughts include:
1) Rebuilding the table into a flat table. However, this will require a major re-work over some application code.
2) Creating a single sql statement and join the table to itself multiple times. I need to select 45 columns, so this would be a huge query. It would be a pain to write and may be even more painful to execute.
Any Ideas?