Hi Friends I wan to Display top 3 results from my database values...i have mentioned the table below can any one tell me how to execute ......
My table is:
NAME Maths English
xxx 98 75
yyy 100 91
eee 94 88
aaa 100 100
fff 78 56
rrr 56 95
my expected answer is:
NAME Maths
yyy 100
aaa 100
xxx 98
Can anyone help me out...
Loading

Iftikar HussainPosted Jul 13, 2013, 7:02 AM
Select Name,maths as Marks from yourtable
Regards,
Iftikar
selva kumarPosted Jul 13, 2013, 5:30 AM
Dilshad AliPosted Jul 13, 2013, 4:32 AM
selva kumarPosted Jul 13, 2013, 4:25 AM
selva kumarPosted Jul 13, 2013, 4:24 AM
Sanjeeb LenkaPosted Jul 13, 2013, 3:31 AM
SELECT TOP 3 NAME,Maths FROM report ORDER BY cast(Maths as int) desc
Iftikar HussainPosted Jul 13, 2013, 3:28 AM
select top 3 Name,cast(Maths as int) from report order by cast(Maths as int) desc
Regards,
Iftikar
selva kumarPosted Jul 13, 2013, 3:22 AM
I Have used ur query but i did't get correct answer...Can u check and tell me exact query....
Iftikar HussainPosted Jul 13, 2013, 3:10 AM
Regards,
Iftikar
Iftikar HussainPosted Jul 13, 2013, 2:54 AM
Regards,
Iftikar
Sanjeeb LenkaPosted Jul 13, 2013, 2:54 AM
select top 3 NAME,Maths from tabelname order by Maths desc
or if you want top 3 math results. then you can use this
SELECT NAME,Maths from
(SELECT *,DENSE_RANK() over( order by Maths desc) SRANK from yourtablename) as MATH
Where SRANK <=3
selva kumarPosted Jul 13, 2013, 2:52 AM
Iftikar HussainPosted Jul 13, 2013, 2:01 AM
You can do like this
SELECT TOP 3 NAME,Maths FROM YourTable ORDER BY Maths desc
Regards,
Iftikar