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 / pradip jain

select sname from (select Row_Number() over (partition by
sname
order by sname) as ROWNO,sname from student) p
order by ROWNO,sname desc


only change table name same as bobby

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the different types of sub-queries?

600


Explain how long are locks retained within the repeatable_read and serializable isolation levels, during a read operation with row-level locking?

660


Explain Geometry datatype in sql server 2008 with example

592


How to view existing indexes on an given table using sys.indexes?

600


do you know how to configure db2 side of the application? : Sql server database administration

598






What is the difference between a primary key and a unique key? Are they the same?

548


What are the components of sql server service broker?

512


You want to use bids to deploy a report to a different server than the one you chose in the report wizard. How can you change the server url?

110


Does union all remove duplicates?

614


What is implicit cursors?

557


How do I find the sql server database version?

534


What is auditing in sql server?

505


What are the differences between having and where clause.

557


List out the differences between the clustered index and non-clustered index in sql server?

506


What does indexation mean?

533