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 indexing explain it with an example?

993


What is difference between createstatement and preparedstatement?

1071


What is the maximum size of column in sql server?

881


What is a heap?

1023


Why truncate is ddl command?

1044


Do you know nested transaction?

944


List the advantages of using stored procedures?

1033


What is difference between order by and group by?

991


What are truncate options available in sql server? : sql server database administration

1006


What specific conditions database should meet, before you can bulk copy data into it using bcp?

967


What are 3 ways to get a count of the number of records in a table?

1058


What is order of B+tree?

1097


What is the difference between system objects and user objects?

1143


What is Replication?

1028


What are horizontal and vertical scaling?

170