Results 1 to 3 of 3
Thread: wat is wrong with my query?
Dec 23, 2001, 20:36 #1
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.
$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_total) DESC, no_total DESC, (time_finish - time_begin) ASC, time_finish DESC LIMIT 1
Dec 23, 2001, 21:09 #2
- Join Date
- Jun 2001
- 0 Post(s)
- 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)");
Ambition is a poor excuse for those without
sense enough to be lazy.
Dec 23, 2001, 21:17 #3
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...