Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
273 views
in Technique[技术] by (71.8m points)

Sum Values for Multiple Distinct Results within SQL Select query

I have the following data set:

Worker Hours
Johnny 8
Johnny 7
Johnny 4
Liz 7
Liz 2
Sally 9
Sally 9
Sally 3
question from:https://stackoverflow.com/questions/65927999/sum-values-for-multiple-distinct-results-within-sql-select-query

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Its a simple group by :

select Worker , sum(Hours) hours
from tablename
group by worker

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...