Question: I have found select statements that basically use different where clauses to count. My question is, how do I combine the results in one statement so that these counts can become columns?

1. select count(\*) as c1 from table1 where city = 'nyc'
2. select count(\*) as c2 from table1 where city = 'boston'
3. select count(\*) as c3 from table1 where city = 'sf'

Answer: 
```
SELECT
  COUNT(CASE WHEN city = 'nyc' THEN 1 END) AS Nyc,
  COUNT(CASE WHEN city = 'boston' THEN 1 END) AS Boston,
  COUNT(CASE WHEN city = 'sf' THEN 1 END) AS Sf
FROM table

```
Using `sum()` and also `filtering only required cities`

```
select sum(case when city = 'nyc' then 1 end) c1,
       sum(case when city = 'boston' then 1 end) c2,
       sum(case when city = 'sf' then 1 end) c3
from table1
where city in ('nyc','boston','sf')

```