forked from science-ation/science-ation
I think this fixes the query, at least temporarily, until we really fix the whole user/year system
This commit is contained in:
parent
8c5a0bd853
commit
c3ed887dca
@ -166,7 +166,7 @@ function neweditor()
|
||||
/* Grab a list of users */
|
||||
$w = array();
|
||||
foreach($show_types as $t) {
|
||||
$w [] = "users.types LIKE '%$t%'";
|
||||
$w [] = "u1.types LIKE '%$t%'";
|
||||
}
|
||||
$where_types = "AND (".join(" OR ", $w).")";
|
||||
|
||||
@ -178,22 +178,23 @@ function neweditor()
|
||||
}
|
||||
|
||||
if($show_year == 'current')
|
||||
$having_year = "AND MAX(`users`.`year`)={$config['FAIRYEAR']}";
|
||||
$having_year = "AND u1.year={$config['FAIRYEAR']}";
|
||||
|
||||
echo "<table class=\"tableview\">";
|
||||
|
||||
$querystr="SELECT
|
||||
*, MAX(`users`.`year`) as maxyear
|
||||
*
|
||||
FROM
|
||||
users
|
||||
LEFT JOIN `users_committee` ON `users_committee`.`users_id`=`users`.`id`
|
||||
LEFT JOIN `users_judge` ON `users_judge`.`users_id`=`users`.`id`
|
||||
LEFT JOIN `users_volunteer` ON `users_volunteer`.`users_id`=`users`.`id`
|
||||
LEFT JOIN `users_fair` ON `users_fair`.`users_id`=`users`.`id`
|
||||
LEFT JOIN `users_sponsor` ON `users_sponsor`.`users_id`=`users`.`id`
|
||||
users u1
|
||||
LEFT JOIN `users_committee` ON `users_committee`.`users_id`=`u1`.`id`
|
||||
LEFT JOIN `users_judge` ON `users_judge`.`users_id`=`u1`.`id`
|
||||
LEFT JOIN `users_volunteer` ON `users_volunteer`.`users_id`=`u1`.`id`
|
||||
LEFT JOIN `users_fair` ON `users_fair`.`users_id`=`u1`.`id`
|
||||
LEFT JOIN `users_sponsor` ON `users_sponsor`.`users_id`=`u1`.`id`
|
||||
WHERE u1.year=( SELECT MAX(`year`) FROM users u2 WHERE u1.uid=u2.uid )
|
||||
GROUP BY uid
|
||||
HAVING
|
||||
users.deleted='no'
|
||||
u1.deleted='no'
|
||||
$having_year
|
||||
$where_types
|
||||
$where_complete
|
||||
|
Loading…
x
Reference in New Issue
Block a user