Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I am facing a common problem in which, I want to fetch only single value from a field that are duplicates values and also get their sum value respectively.
sum
For Example:
I just want to get sum of "profit" of particular year with their year label.
group by
tablename
Use group by to get the desired result
SELECT year, sum(PROFIT) FROM YOURTABLE GROUP BY year
Add a comment
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
sumandgroup bytablenamegroup by year