|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
DB2 question |
« View previous topic :: View next topic » |
Author |
Message
|
ucbus1 |
Posted: Wed Oct 23, 2002 4:50 am Post subject: DB2 question |
|
|
Knight
Joined: 30 Jan 2002 Posts: 560
|
Could some body please let me know whether we can order on a substing of a column
say if I want to order by first 5 characters of column1. for example:
Select column1, column2 form Table1 order by substing(column(1:5))
I appreciate if you can please provide me the syntax ,if it is possible |
|
Back to top |
|
 |
ucbus1 |
Posted: Wed Oct 23, 2002 6:59 am Post subject: Continued... |
|
|
Knight
Joined: 30 Jan 2002 Posts: 560
|
Let me clarify my requirement. Suppose I have
column1 column2
022131E05 02-022131E05
022132E05 02-022132E05
022135E08 00-022135E08
022132E08 00-022132E08
I want sort such that I get Result set in the following order
column1 column2
022131E05 02-022131E05
022132E08 00-022132E08
022132E05 02-022132E05
022135E08 00-022135E08
How can I achieve this? |
|
Back to top |
|
 |
vedbhat |
Posted: Wed Oct 23, 2002 9:43 pm Post subject: |
|
|
 Disciple
Joined: 19 Mar 2002 Posts: 186 Location: Singapore
|
Try,
SELECT COLUMN1, COLUMN2 FROM XXX ORDER BY SUBSTR(COLUMN2, 1, 2) DESC, COLUMN1
This should work. _________________ IBM Certified Solutions Expert - MQSeries Workflow
IBM Certified Specialist - MQSeries |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|