sql help please

  • I have a table tab1 which has data as

    insert into tab1 values(16 ,'\html')

    insert into tab1 values(17 ,'html')

    insert into tab1 values(18, 'html')

    insert into tab1 values(82 ,'html123')

    insert into tab1 values(89 ,'123html')

     

    is there any way i can display the data as

    17 ,'html'

    18, 'html'

    and then the rest of the rows. i tried all wasy even usinga  union but didnt help. any soln will be greatly appreciated.

    TIA

  • select id, txtData, 1 ord From Yourtable where txtData ='html'

    union all

    select id, txtData, 2 ord From Yourtable where txtData <>'html'

    order by ord, id, txtData

     


    * Noel

  • Awesome . Thanks for the help...

  • No problem, Happy to help


    * Noel

  • Another neat trick that you might like :

    select id, txtData From Yourtable order by case txtDate when 'html' then 0 else 1 end

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

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