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.
So I am new to postgres and having some issues, this is my table:
I would like a query to return the table in this format:
I would like the area to be distinct with the sum of all sales in area1 and for area2, any help is appreciated.
You need GROUP BY
SELECT Area, SUM(sales) AS "sales" FROM myTable GROUP BY area ORDER BY area;
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.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.