在mysql中总结两个别名列

时间:2017-11-08 14:40:08

标签: mysql

我尝试将两个别名列相加但失败了,这是我的查询:

SELECT MAX(a.`score`) AS score1,SUM(c.`testscore`) AS score2,b.`first_name`,b.`last_name`,b.`picture` ,
 SUM(score1 + score2) AS grandtotal
FROM test AS a
INNER JOIN employees AS b
ON a.`id` = b.`id`
INNER JOIN game AS c
ON a.`id` = c.`id`

GROUP BY a.`id`;

获取错误:“字段列表”中的未知列'score1'

1 个答案:

答案 0 :(得分:0)

解决方案:

react-materialize