I have a small table, one row, three columns. I need it to be one column three rows.
Thanks, Buzkie
I have a small table, one row, three columns. I need it to be one column three rows.
Thanks, Buzkie
Here is an example for SQL Server. I suspect it might work for DB2.
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.