View previous topic :: View next topic
|
Author |
Message |
ssowmya
New User
Joined: 10 Oct 2006 Posts: 40
|
|
|
|
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 |
|
|
harish_mf
New User
Joined: 31 Jul 2005 Posts: 18 Location: bangalore
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
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 |
|
|
|