If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Convert rows to column

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-03-06, 07:00
ggnanaraj ggnanaraj is offline
Registered User
 
Join Date: Aug 2002
Location: Chennai, India
Posts: 171
Convert rows to column

I have the following table contents:
MONTH STATES
----------- ----------------------
1 5177
2 640
3 6029
4 11086
5 2131


I need to convert this to:

MONTH 1 2 3 4 5

STATES 5177 640 6029 11086 2131


How can I do this?

TIA.
Reply With Quote
  #2 (permalink)  
Old 05-03-06, 09:38
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
There are a number of threads in this forum about this .. One such thread is :

Getting data from several rows onto one

Unless you have a definitve list of columns (which in this case is MONTH), you do not have a pure SQL

HTH

Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On