SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Aug 2004
    Location
    SG
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    getting top 5 scores

    Good day people,

    I have a database(test) which holds records score of students tests sheets. How do I go about retrieving the top 5 marks.

    Regards.
    alex

  2. #2
    SitePoint Zealot Sleeper's Avatar
    Join Date
    Mar 2001
    Location
    Sydney, Australia
    Posts
    143
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    But say you have the names as NAME, and the marks as MARKS.

    Might be a little rusty...

    The SQL I would use is:

    SELECT name, marks FROM test ORDER BY marks DESC LIMIT 0,5

    That would sort out the names and the marks in descending order (highest number down) and the LIMIT would cut it off at 5.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •