Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread row to column
Mon, Mar 10 2008 8:28 AMPermanent Link

silven
Is it possible to convert a single row query result to column format or query result with 2 rows

Table a
---------

col1 | col2 | col3 | col4
21.9  23.4    25.6   27.8


as

col1   21.9
col2   23.4
col3   25.6
col4   27.8

Thanks,
Silven
Mon, Mar 10 2008 10:41 AMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Silven

Not tested, may have syntax errors, but as a first approach you can try
something like this:

select 'col1' as ColName, col1 as ColValue from Table1
union
select 'col2' as ColName, col2 as ColValue from Table1
union
select 'col3' as ColName, col2 as ColValue from Table1
union
select 'col4' as ColName, col2 as ColValue from Table1

--
Fernando Dias

silven escreveu:
> Is it possible to convert a single row query result to column format or query result with 2 rows
>
> Table a
> ---------
>
> col1 | col2 | col3 | col4
> 21.9  23.4    25.6   27.8
>
>
> as
>
> col1   21.9
> col2   23.4
> col3   25.6
> col4   27.8
>
> Thanks,
> Silven
>
Mon, Mar 10 2008 3:53 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Silven,

<< Is it possible to convert a single row query result to column format or
query result with 2 rows >>

Fernando's version should work just fine.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image