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?
table contains name column i want to display senthil at first remaining in order ?
Collapse
X
-
-
Sandeep M
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]Comment
-
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
Comment