SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict joyce's Avatar
    Join Date
    Aug 2001
    Posts
    295
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    wat is wrong with my query?

    wat is wrong with my query?? what i'm trying to get is to select out the highest score for the month. the time_finish are stored as UNIX_TIMESTAMP.



    PHP Code:
    $month date(n);
    $year date(Y);

    SELECT taker_name FROM quirex_record WHERE quiz_id '$quiz_id' and month(UNIX_TIMESTAMP(time_finish)) = $month and year(UNIX_TIMESTAMP(time_finish)) = $year ORDER BY (no_correct/no_totalDESCno_total DESC, (time_finish time_beginASCtime_finish DESC LIMIT 1 

  2. #2
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're just trying to select the largest score for each month? Why not try something simple like:
    PHP Code:
    mysql_query("select taker_name, score from tablename where score = (select max(score) from tablename)"); 
    I believe that works with MySQL; it works in Oracle.
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.

  3. #3
    SitePoint Addict joyce's Avatar
    Join Date
    Aug 2001
    Posts
    295
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i can' t do that ..cos the largest score..i have to calculate who get the highest score, if there are two ppl get the higher score, then who use the less time to finished that exam. there is only one highest scorer only..

    besides, i've already got that query, wat i'm askin is..how to select out...high scorer for every month...


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
  •