Topic: SQL query question
Hi,
I'm trying to make some statistics of our forum. For example : top10 of poster in current week.
This is the code SQL I have tried:
$num = 10;
$condition = 'WHERE WEEK(FROM_UNIXTIME(posted,"%Y-%m-%d"),3)=WEEK(CURDATE(),3)';
$result = $db->query('SELECT poster,count(*) AS numpost FROM '.$db->prefix.
$type.' '.$condition.' GROUP BY poster ORDER BY numpost DESC LIMIT '.$num)
or error('Unable to get info',__FILE__, __LINE__, $db->error());
But results is not correct
I'm newbie in SQL. So I would like to hear your comments.
TIA.