gpt4 book ai didi

sqlite - 选择总和并按SQLITE分组

转载 作者:行者123 更新时间:2023-12-03 14:55:41 32 4
gpt4 key购买 nike

我有一个带4个字段(ID,名称,角色,点)的sqlite表,我想要字段的总和WHERE角色='something'AND name ='something'

我的查询无法正常工作:

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

关于sqlite - 选择总和并按SQLITE分组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43102643/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com