|
|
|
|
(SELECT TR.EvRank As Rank, TR.EvRank As RankSort,
if((P.Sex='T' OR P.Sex='TM' OR P.Sex='TF' OR P.Sex='N'), concat(P.given,'--',P.Family),
concat(P.given,' ',P.Family)) AS Name,
concat(P.Family,P.Given) AS NameSort,
Cat.Category, Cat.Abbrev, P.Sex,
Cat.ColorM, Cat.ColorF,
concat(Cat.MinAge,P.Sex,R.EvTime) As CatTime,
(TR.EvCatRank*100)+Cat.MinAge As CatSort,
if(hour(R.EvTime)=0,time_format(R.EvTime, '%i:%s'),
time_format(R.EvTime, '%l:%i:%s')) as evtime,
format((((E.dxkms)/((time_to_sec(R.Evtime)))*60)*60),2) AS AvSpeed,
(((E.dxkms)/((time_to_sec(R.Evtime)))*60)*60) AS SpeedSort,
TR.EvCatRank AS CatRank,
TR.EvCatRank AS CatRankSort,
Cat.MinAge, Cat.MaxAge,
P.PersID AS Id, Clubs.Abbrev as Club, Clubs.ClubName, R.EntryID
FROM Persons AS P, Results AS R, Events AS E, Categories AS Cat, Clubs,
EvRanks as TR
WHERE P.PersID=R.PersID and E.EventID=R.EventID and
Clubs.ClubID=R.ClubID and R.EntryID=TR.EntryID and
((year(E.eventdate)-year(P.DOB)) between Cat.MinAge and Cat.MaxAge ) and
E.EventID = '663'
and Cat.Abbrev like '%' and P.Sex like '%'
and Clubs.Abbrev like '%')
UNION (SELECT null As Rank, 999 As RankSort,
if((P.Sex='T' OR P.Sex='TM' OR P.Sex='TF' OR P.Sex= 'N'), concat(P.given,'--',P.Family),
concat(P.given,' ',P.Family)) AS Name,
concat(P.Family,P.Given) AS NameSort,
Cat.Category, Cat.Abbrev, P.Sex,
Cat.ColorM, Cat.ColorF,
concat(Cat.MinAge,P.Sex,P.Family,P.Given) As CatTime,
('9999')+Cat.MinAge As CatSort,
DNSF.Status,
NULL AS AvSpeed, 9999 as SpeedSort,
NULL AS CatRank, 99 as CatRankSort,
Cat.MinAge, Cat.MaxAge,
P.PersID AS Id, Clubs.Abbrev as Club, Clubs.ClubName, Null as EntryID
FROM Persons AS P, DNSF, Events AS E, Categories AS Cat, Clubs
WHERE P.PersID=DNSF.PersID and E.EventID=DNSF.EventID and
Clubs.ClubID=DNSF.ClubID and
((year(E.eventdate)-year(P.DOB)) between Cat.MinAge and Cat.MaxAge ) and
E.EventID = '663'
and Cat.Abbrev like '%' and P.Sex like '%'
and Clubs.Abbrev like '%')
ORDER BY RankSort
Fatal error: Uncaught mysqli_sql_exception: 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, TR.EvRank As RankSort,
if((P.Sex='T' OR P.Sex='TM' OR P.Se' at line 1 in /home/obc/public_html/tt/ttevent.php:428
Stack trace:
#0 /home/obc/public_html/tt/ttevent.php(428): mysqli_query()
#1 {main}
thrown in /home/obc/public_html/tt/ttevent.php on line 428
| |