作者:手机用户2502873667 | 来源:互联网 | 2022-12-15 16:10
Ihavethefollowingstatementthatfindsalltheplayersofateaminthecurrentseason.Theplaye
I have the following statement that finds all the players of a team in the current season. The players are ordered by their handicap. If their handicaps are the same they are ordered by the oldest added_date
, meaning newer members are lower down the list.
我有以下声明,找到当前赛季球队的所有球员。球员按他们的差点命令。如果他们的障碍是相同的,他们按最旧的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
The handicaps
table can have multiple entries per player for any reviews they have had.
对于他们所拥有的任何评论,障碍表可以为每个玩家提供多个条目。
I can't figure out how to make the latest handicap to be used for the ordering (something maybe to do with MAX on added_date?) yet at the same time if two or more handicaps are the same it order them by oldest registered first based on added_date.
我无法弄清楚如何使最新的差点用于订购(可能与MAX在added_date上有关?)但同时如果两个或更多的障碍是相同的,它按最早注册的顺序排序在added_date上。
2 个解决方案