The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
|
#1
|
|||
|
|||
Query question - PLEASE HELP!!!
I really need a hack that displays the average age. Currently I am using this plugin:
PHP Code:
Andreas/KirbyDE had given me this query instead that is supposed to be more accurate: [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] but it gives a database error: Code:
Database error in vBulletin 3.5.0: Invalid 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 testvb_user WHERE YEAR(birthday_search)>0; MySQL Error : You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(NOW()) < DAY(birthday_search)))) AS avgage FROM testvb_user WH Error Number : 1064 |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|