I have the following table:
Mytable:
-------
col1 INT
col2 INT
col3 INT
And in postgresql I want to count the number of occurences that a combination of values in col1, col2, col3 occur.
For example if the Mytable
has the values:
col1 | col2 | col3
---- | --- | ---
1 | 5 | 3
1 | 8 | 3
1 | 5 | 3
1 | 5 | 3
1 | 5 | 3
1 | 5 | 4
1 | 5 | 4
2 | 5 | 3
1 | 8 | 3
How I can generate the following result:
col1 | col2 | col3 | count
---- | --- | --- | ---
1 | 5 | 3 | 4
1 | 8 | 3 | 2
2 | 5 | 3 | 1
1 | 5 | 4 | 2
Asked by Dimitrios Desyllas
(873 rep)
Jul 27, 2022, 09:46 AM
Last activity: Apr 15, 2025, 10:03 AM
Last activity: Apr 15, 2025, 10:03 AM