Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sort records based on substring value in a column 1

Status
Not open for further replies.

hemajb

Programmer
Sep 26, 2003
19
IN
Hello,

I have a table with the column "name" which has values like AAO1LC,BB03RS,CC02LC,DA02LC,CRT,RAELT. i want a query to sort this based on 01,02 ,i.e based on 2 and 3 char of name.

could anyone let me know how do i need to use select statement here.

thanks
 
Code:
select * from tableName order by substring(name, 2, 2);

where the substring syntax is:
substring(column name, start index, length)

Please check the exact synatx for the database server that you are working with.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top