Home Forums SQL Server 2005 T-SQL (SS2K5) How to Sort SQL Results in Your Own Preferred Order RE: How to Sort SQL Results in Your Own Preferred Order

  • halifaxdal (7/23/2010)


    Thank you in advance, here is a sample:

    CREATE TABLE tbl

    (

    ID int,

    [Name] varchar(50)

    )

    insert into tbl (ID, [Name]) values(1, 'John Doe')

    insert into tbl (ID, [Name]) values(2, 'John Smith')

    insert into tbl (ID, [Name]) values(3, 'Jane Doe')

    insert into tbl (ID, [Name]) values(4, 'Bill Clinton')

    insert into tbl (ID, [Name]) values(5, 'Hello Kitty')

    My expected result would be 'Select All' on top of the ordered result.

    It would help if you showed us the desired results. I understand you want 'Select All' on top, but how should the other names be sorted; by name or ID?