Php 找到联盟中得分最高的球员

Php 找到联盟中得分最高的球员,php,mysql,sql,database,Php,Mysql,Sql,Database,我不熟悉数据库。我被分配了一个与足球联赛有关的任务,一些球队在主场和客场比赛,分数被存储等等。我有下面的表格 goals ====================== goal_id goal_player_people_id goal_game_id goal_score player ===================== player_people_id player_team_id people ==================== people_id people_fir

我不熟悉数据库。我被分配了一个与足球联赛有关的任务,一些球队在主场和客场比赛,分数被存储等等。我有下面的表格

goals
======================
goal_id 
goal_player_people_id
goal_game_id
goal_score

player
=====================
player_people_id
player_team_id

people
====================
people_id
people_first_name
people_last_name
people_dob
我需要找出最佳得分手的名字,请帮忙。

如果goals.goal\u player\u people\u id是指人。people\u id:

select  people_first_name people_last_name
from people
where people_id not in(
    select A.id
    from(
        select goal_player_people_id as id,count(*) as gc
        form goals
        group by goal_player_people_id) A,
        (
        select goal_player_people_id as id,count(*) as gc
        form goals
        group by goal_player_people_id) B,
    where A.gc<B.gc
)

表的名称真的那么长吗?是列名,而不是表名。这是一个非常简单的查询。你尝试过什么?将进球与球员和人联系起来,按进球排序,得分返回1我认为,这就像从表中选择maxcountfield一样。。。。
SELECT p.people_first_name, p.people_last_name, SUM(g.goal_score) totscore
FROM goals g
JOIN people p
ON g.goal_player_people_id = p.people_id
GROUP BY p.people_id
ORDER BY totscore DESC LIMIT 1;