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 Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts Table(Unicode(Graphic) table) loading... muralikrishnan_new DB2 0 Thu Oct 05, 2017 5:10 pm
No new posts opening a dataset after reading it fr... arunsoods DFSORT/ICETOOL 5 Wed Oct 04, 2017 3:54 pm
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am

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