Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is catalog views?

1068


What is page in sql server?

947


What are the different types of columns types constraints in the sql server?

1080


What is a join in sql? What are the types of joins?

1108


Explain the creation and execution of a user-defined function in the sql server?

1051


How to convert binary strings into integers in ms sql server?

1030


What does <> symbol mean?

974


How to use subqueries with the in operators in ms sql server?

1074


What is triggers and stored procedures?

943


What is the web service used for reporting services?

123


Explain the dirty pages?

1007


What is the difference between online clustering and Offline clustering?

2419


What are data regions?

135


What is Dependency Injection and provide example?

1117


What is BCP? When does it used in sql server 2012?

1063