Sql State First mark in a board exam

Posted by Raja_89 under Sql Server on 4/11/2013 | Points: 10 | Views : 847 | Status : [Member] | Replies : 1
Hai
how can i retrieve the candiate name of a first mark holder in a board exams


Select * from S_details group by mark having max(mark)

Whether the above is query is valid




Responses

Posted by: Pandians on: 4/11/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
Check It Out!
CREATE TABLE S_details

(
Name VARCHAR(100),
Mark NUMERIC(5,2)
)
Go

INSERT S_details VALUES('Aequea',99.96)
INSERT S_details VALUES('Salino',99.98)
INSERT S_details VALUES('Calcalino',99.18)
INSERT S_details VALUES('Setaceo',98.17)
INSERT S_details VALUES('Socaprio',98.90)
INSERT S_details VALUES('Alumino',98.09)
INSERT S_details VALUES('Vitriolic',99.98)
Go

SELECT Name,Mark, Dense_Rank() Over(Order By Mark Desc) [Rank] FROM S_details
Go
Result
Name       Mark	      Rank

------ ---------- -------
Salino 99.98 1
Vitriolic 99.98 1
Aequea 99.96 2
Calcalino 99.18 3
Socaprio 98.90 4
Setaceo 98.17 5
Alumino 98.09 6


Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions

Raja_89, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response