From two columns in my table I want to get a unified count for the values in these columns. As an example, two columns are:
Table: reports
| type
You can use filter clause as well:
SELECT
type,
sum(1) FILTER (WHERE place = 'home') AS home,
sum(1) FILTER (WHERE place = 'school') AS school,
sum(1) FILTER (WHERE place = 'work') AS work,
sum(1) FILTER (WHERE place = 'cafe') AS cafe,
sum(1) FILTER (WHERE place = 'friends') AS friends,
sum(1) FILTER (WHERE place = 'mall') AS mall
FROM
reports
GROUP BY
type