开发者

Query for converting rows in columns

开发者 https://www.devze.com 2023-03-15 00:45 出处:网络
I want to covert rows to columns.IE: Take the following: HOPPER_CLOSE_TIMEHOPPER_OPEN_TIMESR_NOCAL_DONEPARTIAL_CALC_DONE_TIME

I want to covert rows to columns. IE: Take the following:

HOPPER_CLOSE_TIME     HOPPER_OPEN_TIME     SR_NO    CAL_DONE  PARTIAL_CALC_DONE_TIME
------------------------------------------------------------------------------------
23-06-2011 10:26:41   23-06-2011 10:29:23  535100   2         23-06-2011 10:28:41

and i want it this way

HOPPER_CLOSE_TIME         23-06-2011 10:26:41
HOPPER_OPEN_TIME   开发者_开发技巧       23-06-2011 10:29:23
SR_NO                     535100
CAL_DONE                  2
PARTIAL_CALC_DONE_TIME    23-06-2011 10:28:41


select HOPPER_CLOSE_TIME  new_column_name from table1 where your_condition_here
union all
select  HOPPER_OPEN_TIME  new_column_name from table1 where your_condition_here
union all
select  SR_NO             new_column_name from table1 where your_condition_here
union all
select CAL_DONE           new_column_name from table1 where your_conidtion_here
union all
selectnPARTIAL_CALC_DONE_TIME new_column_name from table1 where your_condition_here
0

精彩评论

暂无评论...
验证码 换一张
取 消