• If you want help, to start with, you really need to explain what it is you are trying to do. You posted a query which doesn't do what you want so we can't tell for sure from that what you want because we already know the query is wrong. You posted the data you wish to see but there are an infinite number of ways of producing that output data, including a query which just contains those values as literals. Most of those ways (including the one with the literals) are likely not at all what you want -- but you haven't told us what you want so we can only guess.

    From the nature of the data, I suspect that what you are trying to get is the row, for each quiz number, which has the highest score (I have no idea what you want to do if there is more than one row with the high score so I will just presume that you want all of them).

    I don't have time to explain what is wrong with your query but suffice it to say that the correlated subquery is absolutely useless because it always produces the same value as the main query, so you always get the full table (also, it is attempting to filter by the quiz_no when apparently you want to filter by the score).

    So, my guess at what you want is:

    SELECT a.Quiz_No,a.Mobile_No,a.Score,a.TotalTime,a.TotalQuestion

    FROM dbo.tbl_FaceBookScore a

    WHERE a.Score =

    (

    SELECT TOP 1 y.Score

    FROM dbo.tbl_FaceBookScore y

    WHERE y.Quiz_No = a.Quiz_No

    ORDER BY y.Score DESC

    )

    ORDER BY a.Quiz_No ASC, TotalTime DESC

    Not tested because you provided no INSERT statements to populate the table and I'm not going to spend my time doing the work you should have done.

    I hope that helps.

    - Les