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 page-level compression?

903


What is data block and how to define data block size?

977


What are click through reports?

138


What do you understand by the data quality services in sql server?

900


What is the use of sign function?

1034


what is the system function to get the current user's user id? : Sql server database administration

954


after migrating the dts packg to ssis by using migrtn wizrd in 2005. iam not able to open ssis pack and getting error. what r those errors? how to resolve?

2042


How much does sql server 2016 cost?

987


you accidentally delete the msdb database what effect does this have on your existing sql databases, and how do you recover? : Sql server administration

1193


Can primary key be a foreign key?

997


How to copy data from one table to another table?

933


What is normalization? Explain different forms of normalization?

1070


After removing a table from database, what other related objects have to be dropped explicitly?

998


How to insert multiple rows with one insert statement in ms sql server?

1055


What is the openxml statement in sql server?

1009