如何在mysql中添加列值 [英] How to add column values in mysql
本文介绍了如何在mysql中添加列值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的表格数据Student
这是我的查询-
SELECT id, SUM( maths + chemistry + physics ) AS total, maths, chemistry, physics
FROM `student`
但它只抛出一行-
id total maths chemistry physics
118 760 55 67 55
尽管我想对所有ID应用总和....让我知道我该如何实现呢?
although i want to apply sum for all ids ....let me know how can i achieve this?
推荐答案
Sum是一个聚合函数.您不需要使用它.这是简单的查询-
Sum is a aggregate function. You dont need to use it. This is the simple query -
select *,(maths + chemistry + physics ) AS total FROM `student`
这篇关于如何在mysql中添加列值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文