tags:

views:

69

answers:

2

I have a small table, one row, three columns. I need it to be one column three rows.

Thanks, Buzkie

A: 

Here is an example for SQL Server. I suspect it might work for DB2.

Mark Wilkins
I found that one. That is just taking a column and filtering it to make new ones, column to rows. I need row to columns
Buzkie
I think I understand what you are looking for then. It seems to me that Martin's answer is the correct one.
Mark Wilkins
+2  A: 

For such a small table, why not use a UNION?

SELECT new_column_name
    FROM (
    SELECT col1 AS new_column_name
    FROM   table
    UNION
    SELECT col2
    FROM   table
    UNION
    SELECT col3
    FROM   table
) AS new_table

For larger tables, you could use the approach described in MarkW's post. The DB2 function COALESCE() gives the same functionality as ISNULL() in those SQL Server examples.

martin clayton
it ended up working. It was just a pain due to the way each of the columns were pulled. Thanks for your help
Buzkie