mysql - Error when trying execute statement with where from joined table in subquery -
i'm trying rank of spent hours table in amount of time. works. want restrict 1 usergroup. made this:
select s.shortname servername, s.displaycolor displaycolor, min( if(`yearweek`=yearweek(current_date(),3) , (s.admin_group=u.usergroupid or find_in_set(s.admin_group, u.membergroupids)>0), (select count(*) godziny_tygodnie x left join vbulletin.vb_user xu on xu.userid=x.dbid gw.sid=x.sid , x.`yearweek`=gw.`yearweek` , x.`time` > gw.`time`)+1 , ( xu.usergroupid=s.admin_group or find_in_set(s.admin_group, xu.membergroupids)>0) , null) ) rweek0, -- there more columns simillar previous, different time interval godziny_tygodnie gw inner join godziny_miesiace gm on gw.dbid=gm.dbid , gw.sid=gm.sid inner join godziny_lacznie gt on gw.dbid=gt.dbid , gw.sid=gt.sid left join serwery s on s.id=gw.sid left join vbulletin.vb_user u on u.userid=gw.dbid gw.dbid=:uid group gw.dbid, gw.sid
and gives me error column not found: 1054 unknown column 'xu.usergroupid' in 'field list'
why can't executed? vbulletin.vb_user.usergroupid
exists...
problem wrong parenthesis. )+1
end of 9. line should on end of 10 line. works :)
Comments
Post a Comment