Postgresql Multiple counts for one table
you can use case in this case – SELECT type, sum(case when place=”home” then 1 else 0 end) as Home, sum(case when place=”school” then 1 else 0 end) as school, sum(case when place=”work” then 1 else 0 end) as work, sum(case when place=”cafe” then 1 else 0 end) as cafe, sum(case when place=”friends” then 1 … Read more