mysqli error: [1064: 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 'rank
,concat(firstname,' ',lastname) name
' at line 3] in EXECUTE("SELECT *
FROM (SELECT member_id
,@rank := @rank + 1 as rank
,concat(firstname,' ',lastname) name
,city
,team
,format(yearpoints,1) yearpoints
,format(yearhandspeed,3) yearhandspeed
,format(yearprecision,1) yearprecision
,sessioncount
FROM ( select m.member_id
,concat('',m.firstname,'') firstname
,concat('',m.lastname,'') lastname
,m.city
,m.team
,t.yearpoints
,t.yearhandspeed
,t.yearprecision
,ms.sessioncount
from t_member m,t_rh_memberstat ms
,(select r.member_no
,avg(r.daypoints) yearpoints
,avg(r.dayhandspeed) yearhandspeed
,avg(r.dayprecision) yearprecision
from (select @rownum := (@member_no=member_no)*(@rownum + 1) as rownum
,@member_no:=member_no as member_no
,s.daypoints
,s.dayhandspeed
,s.dayprecision
from (select td.member_no
,tm.gender
,(year(td.resultdate)-year(tm.birthdate))-(right(td.resultdate,5)'0000-00-00'
order by td.member_no,td.daypoints desc
) s
) r
where r.rownum < 3
group by r.member_no
) t
where t.member_no=m.member_no and m.member_no=ms.member_no
order by yearpoints desc ) ctab ) ltab LIMIT 0,50")