sorting varchar2 type if it contains numeric values

  • Hi

    my table is like this

    fig no

    1

    2

    3

    1a

    2b

    2c

    1c

    1b

    11

    12

    this to be sort like this

    1

    1a

    1b

    1c

    11

    12

    2

    2b

    2c

    3

    please any one give me the sql query for this?

    Thanks

    samba

  • Hi,

    try this

    create table #temp

    (

    figno varchar(3)

    )

    insert into #temp

    select '1'

    union all

    select '2'

    union all

    select '3'

    union all

    select '1a'

    union all

    select '2b'

    union all

    select '2c'

    union all

    select '1c'

    union all

    select '11'

    union all

    select '12'

    select * from #temp

    select * from #temp

    order by LEFT (figno,1)

    ARUN SAS

  • hi

    What ever you are trying to say is correct if the rows are fixed.

    that column is not fixed. it may have so many rows. and i want that to be sorted like folders sorting(means in if you sort folders my name in drive how it will show like this)

  • iamsambu (5/14/2009)


    and i want that to be sorted like folders sorting(means in if you sort folders my name in drive how it will show like this)

    Hi,

    you need sort in the SQl or in OS?

    give some examples.

    ARUN SAS

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply