我正在尝试制作一个模拟数据库,显示三个独立游戏角色的设备数据。当我运行以下 SQL 时,我能够拉出整个表
SELECT customerID, characters.characterID, characterName, headName, chestName, legsName, armsName
FROM characters
JOIN character_equipmentv ON characters.characterID = character_equipment.characterID
JOIN gear_head ON character_equipment.headID = gear_head.headID
JOIN gear_chest ON character_equipment.chestID = gear_chest.chestID
JOIN gear_legs ON character_equipment.legsID = gear_legs.legsID
JOIN gear_arms ON character_equipment.armsID = gear_arms.armsID
ORDER BY characterID
但是,当我添加SUM
函数来获取角色的齿轮分数时:
SUM(gear_head.gearScore + gear_chest.gearScore + gear_legs.gearScore + gear_arms.gearScore) AS gearScore
在我的 SELECT 语句结束时,它只显示第一个条目以及每个字符的组合齿轮分数!我怎样才能解决这个问题?