Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6075681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:31:18+00:00 2026-05-23T10:31:18+00:00

I have a list of records in database class D1.1: First D2.12: second D1.14:

  • 0

I have a list of records in database class

D1.1: First
D2.12: second
D1.14: third
D2.8: fourth
D2.2: fifth
D2.3: fifth
D1.7: fifth
D2: fifth
D1.5: fifth

How should I sort by taking the consideration the codes of D like 1.1, 2.12. 1.14 etc ?

The output required should be below.

D1.1: First  
D1.14: third  
D1.5: fifth
D1.7: fifth    
D2: fifth
D2.12: second
D2.2: fifth
D2.3: fifth
D2.8: fourth
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:31:19+00:00Added an answer on May 23, 2026 at 10:31 am

    Not clear exactly from your post how the data is in the actual table, but if it’s in the field formatted like that then you could order it by using SUBSTRING. Here’s an example:

    DECLARE @test AS TABLE (
    data varchar(50)
    )
    
    INSERT @test VALUES ('D1.1: First')
    INSERT @test VALUES ('D2.12: second')
    INSERT @test VALUES ('D1.14: third')
    INSERT @test VALUES ('D2.8: fourth')
    INSERT @test VALUES ('D2.2: fifth')
    INSERT @test VALUES ('D2.3: fifth')
    INSERT @test VALUES ('D1.7: fifth')
    INSERT @test VALUES ('D2: fifth')
    INSERT @test VALUES ('D1.5: fifth')
    
    SELECT data FROM @test
    ORDER BY SUBSTRING(data,2,CHARINDEX(':',data,0)-2)
    

    Result:

    data
    --------------------------------------------------
    D1.1: First
    D1.14: third
    D1.5: fifth
    D1.7: fifth
    D2: fifth
    D2.12: second
    D2.2: fifth
    D2.3: fifth
    D2.8: fourth
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list view which is populated via records from the database. Now
I have a list: Collection users which has around 100K+ records of users (all
I have the script shown below that displays a list of records from a
lets's say I have: // all objects have valid mapping to database public class
I have 65000 records of employees in a database . i am retreiving all
I have a question about generic list. Assume that I have a database which
I have a gridview and binding the records in it from a list.I need
I have a list of record Id's that I want to retrieve from Sql
I have a comma delimited list of record id's: string = 2207,117,90,2168,120,118,113,112,17 I need
I have a record store which holds a list of shopping items i am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.