I am performing group by to get the count of every individual value along with the total count.
Data,
It is very easy to get the count of individual columns using below queries,
select name, colour, count(1) from table group by name, colour;
select colour, count(1) from table group by colour;
I need both the results in a single query. Expected result is,
I need total count of Name in every row with respect to Colour.
Any suggestion would be appreciated
2
Answers
You can use window function
count()
:Demo here