i have a table student like
sname
-----
ram
ram
ram
raj
raj
raj
i need the output like
sname
-----
ram
raj
ram
raj
ram
raj
Answer Posted / sagun sawant
;with TEST as (select Row_Number() over (partition by sname
order by sname) as ROWNO,sname from student)
select sname from TEST order by ROWNO,(case when sname
= 'RAM' then 1
when sname = 'RAJ' then 2 end)
| Is This Answer Correct ? | 9 Yes | 1 No |
Post New Answer View All Answers
What are sql servers used for?
How would you go about developing a ssrs report?
how can you check the level of fragmentation on a table? : Sql server administration
How to select some specific rows from a table in ms sql server?
Explain few examples of RDBMS?
What is the difference between functions and scalar functions?
How to transfer data from a cursor to variables with a "fetch" statement?
How is sql used in sql server?
what is nonclustered index
What are the differences between user defined functions and stored procedures?
What is tabulation?
How to create a simple table to test triggers in ms sql server?
What are the properties of the transaction?
what are the critical issues you have resloved in your company
What is the difference between truncate and delete commands?