Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Load the data into Table2 sorting by the first column

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
ssowmya

New User


Joined: 10 Oct 2006
Posts: 40

PostPosted: Wed Jan 24, 2007 4:57 pm    Post subject: Load the data into Table2 sorting by the first column
Reply with quote

Hi All

I have a table, say Table1 and it has no key and the records are also not sorted...I need to load the data into Table2 (similar structure) sorting by the first column. The query I use is

INSERT INTO TABLE2 SELECT * FROM TABLE1 ORDER BY COLUMN1

But when I do a SELECT * FROM TABLE2, the records are not sorted by COLUMN1. Please let me know where I am going wrong....

Thanks
Sowmya
Back to top
View user's profile Send private message

harish_mf

New User


Joined: 31 Jul 2005
Posts: 18
Location: bangalore

PostPosted: Wed Jan 24, 2007 5:18 pm    Post subject:
Reply with quote

Hi all,

I have a table like,

emp id joined month ......
1 feb
2 mar
3 june
4 jan
'' ....
like this including all the month, Now I want it to sort it by month.


Could you please guide me how to sort by month in DB2.

Thanks & Regards

Harish.B
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Jan 24, 2007 7:29 pm    Post subject:
Reply with quote

Hello,

In both cases, use an ORDER BY in the select that you need the rows returned in sequence. A select with NO "order by" says you do not need any particular sequence.
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Wed Jan 24, 2007 9:29 pm    Post subject: Re: Load the data into Table2 sorting by the first column
Reply with quote

Harish.B,

can you please start a new post for your question? Also, What are the exact abbreviations fro the months?

Thanks,
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Passing data from REXX to C programme... chong.zhou CLIST & REXX 1 Wed Jul 26, 2017 9:11 pm
No new posts Passing data from REXX to C programme... chong.zhou All Other Mainframe Topics 0 Wed Jul 26, 2017 4:55 pm
No new posts copying data without knowing location arunsoods DFSORT/ICETOOL 6 Thu Jul 20, 2017 1:03 pm
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us