在1条select语句中选择Sum和多列 [英] Select Sum and multiple columns in 1 select statement
本文介绍了在1条select语句中选择Sum和多列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在SQL中是否可以同时选择一列和其他列的总和?
Is there a way to select the sum of a column and other columns at the same time in SQL?
示例:
SELECT sum(a) as car,b,c FROM toys
推荐答案
尝试添加GROUP BY
try add GROUP BY
SELECT sum(a) as car,b,c FROM toys
GROUP BY b, c
这篇关于在1条select语句中选择Sum和多列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文