我有以下语句可以找到当前赛季一支球队的所有球员。球员按他们的差点排序。如果他们的差点相同,则按最老的排序added_date
,这意味着较新的成员在列表的下方。
SELECT players.playerid_p,
players.fname,
players.sname,
players.tel,
players.mob,
players.email,
season_players.captain
FROM season_players
LEFT JOIN players ON (season_players.playerid_f = players.playerid_p)
LEFT JOIN handicaps ON (handicaps.playerid_f = players.playerid_p)
WHERE season_players.seasonid_f = '$currentSeason'
AND season_players.teamid_f = '".$row["teamid_p"]."'
GROUP BY players.playerid_p
ORDER BY handicaps.handicap ASC, handicaps.added_date ASC
对于每个玩家的任何评论,该handicaps
表可以有多个条目。
我不知道如何制作用于订购的最新让分(可能与added_date上的MAX有关?)但同时如果两个或更多让分相同,它会按最旧的注册优先顺序排序在添加日期。