I have two columns:
Segments consumers
Premium 15630
Low 5000
Premium 5
Family shopper 45600
Family Shopper 56
and I want to have a total result for each segment like:
Segments Consumers
Premium xxx
Low xxx
Family Shopper xxx
CodePudding user response:
select segments, SUM(consumers)
from your_table_name
group by segments;
This will be the same for pretty much all database systems but you might wanna read the documentation on those clauses for your database system as they are quite fundamental. See PostgreSQL SUM.
CodePudding user response:
SELECT Segments, SUM(Consumers) FROM Table GROUP BY Segments