如何显示分组中的所有列

时间:2018-02-01 07:31:36

标签: php mysql sql laravel

我有两个表teambobotteam,然后我尝试了这个查询:

SELECT team.id , bobotteam.teamfight/MAX(bobotteam.teamfight)
    FROM team
    INNER JOIN bobotteam on team.id = bobotteam.id

为什么数据只显示1个数据,即使bobotteam表中有两个数据。 IMAGE

Query Table image Bobotteam Table image

1 个答案:

答案 0 :(得分:4)

请试试这个:

SELECT team.id , bobotteam.teamfight/(select MAX(bobotteam.teamfight) from bobotteam)
FROM team
INNER JOIN bobotteam on team.id = bobotteam.id