** 期望:现在想统计 一个队伍下,所有人和所有人的总时长。**

原来写的是这样

修改为 这样就可以了
SELECT ref.team_id,
count(distinct ref.account_id) AS volunteerNum,
sum(time.volunteer_duration) AS volunteerTimeTotal
FROM volunteer_team_ref AS ref
LEFT JOIN volunteer_duration AS time ON ref.account_id = time.account_id
where ref.is_deleted = '0'
GROUP BY ref.team_id;
513



被折叠的 条评论
为什么被折叠?



