开发者

Query for converting rows in columns

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜