选择sum并按SQLITE分组
我有一个包含4个字段(id、name、role、points)的sqlite表,我需要role='something'和name='something'的字段点的总和 我的查询无法正常工作:选择sum并按SQLITE分组,sqlite,sum,Sqlite,Sum,我有一个包含4个字段(id、name、role、points)的sqlite表,我需要role='something'和name='something'的字段点的总和 我的查询无法正常工作: select id,name,role, points (select sum(points) from salvataggi_punti_giocatori where role = 'por') as total from salvataggi_punti_giocatori 为了执行聚合函数,
select id,name,role, points (select sum(points)
from salvataggi_punti_giocatori where role = 'por')
as total from salvataggi_punti_giocatori
为了执行聚合函数,必须首先对列进行分组
SELECT sum(points)
FROM salvataggi_punti_giocatori
WHERE role = 'value'
AND name = 'value'
GROUP BY role, name