What's wrong with this query?
Can anyone point me to the right direction in what's wrong with the query below? The query is supposed to be in a plugin that displays the average age in forumhome (not mine), but it gives a database error:
[sql]
SELECT ROUND(AVG(YEAR(NOW())-YEAR(birthday_search) - (MONTH(NOW()) < MONTH(birthday_search)) - (MONTH(NOW()) = MONTH(birthday_search) AND DAY(NOW()) < DAY(birthday_search)))) AS avgage FROM " . TABLE_PREFIX . " user WHERE YEAR(birthday_search)>0
[/sql]
|