table contains name column i want to display senthil at first remaining in order ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • irvin
    New Member
    • Aug 2007
    • 1

    #1

    table contains name column i want to display senthil at first remaining in order ?

    I have a table , values are available in name column, i want to display senthil at first and remaining name in order andone can help me on this?
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    kindly pass more information.

    Comment

    • Sandeep M

      #3
      Pls try this

      [code=oracle]
      SELECT name, case name WHEN 'senthil' THEN 0 ELSE 1 END AS temp FROM users ORDER BY temp,name
      [/code]
      Last edited by amitpatel66; Nov 8 '10, 01:42 PM. Reason: Added code tags

      Comment

      • amitpatel66
        Recognized Expert Top Contributor
        • Mar 2007
        • 2358

        #4
        Try this:

        [code=oracle]
        SQL> ed
        Wrote file afiedt.buf

        1 with t as (select 'Senthil' col1 from dual
        2 union select 'ABCD' from dual
        3 union select 'John' from dual
        4 union select 'Alex' from dual)
        5 SELECT col1 FROM t
        6* ORDER BY (CASE WHEN UPPER(col1) = 'SENTHIL' THEN 0 ELSE 1 END)
        SQL> /

        COL1
        -------
        Senthil
        John
        ABCD
        Alex

        SQL>
        [/code]

        Comment

        Working...