如何计算计数值?

时间:2015-06-15 08:23:57

标签: mysql sql

Table-1

Name.  Count
Xyz.        2
Yejs.       4
We.         6

我想要计算总和

2 个答案:

答案 0 :(得分:1)

使用聚合函数可以得到总和

对于E.g

Select SUM(Count) from [Table-1]

答案 1 :(得分:0)

select name, count(*) as mycount,
  (select count(*)
   from table_1) as totalcount
from
table_1
group by name
order by mycount

Fiddle