Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Data security erase on RAID device steve-myers All Other Mainframe Topics 0 Sat Jan 13, 2018 6:41 am
No new posts Append the milliseconds to the data s... girishb2 DFSORT/ICETOOL 1 Thu Dec 21, 2017 9:07 pm
No new posts Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Fetching data from JHS as per the cur... arunsoods All Other Mainframe Topics 4 Wed Nov 22, 2017 1:54 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us