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 the difference between stored procedure and user defined functions?

1236


What do you mean by subquery?

1145


What is partitioned view?

960


What are the benefits of normalization?

1156


What is the difference between varchar and nvarchar datatypes?

1142


What are the two modes of authentication in sql server?

1136


How to insert stored procedure result into temporary table?

1064


Explain what you mean by 3 tier architecture.

1124


How to set a database state to offline in ms sql server?

1104


How to perform backup for certificates in sql server? : sql server security

1143


What is for xml in sql server?

1137


What are the encryption mechanisms in sql server?

1080


What is a partition key?

1030


What is a matrix in ssrs?

158


Explain the purpose of indexes?

1021