Question: Imagine this db structure:

```
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`correct` tinyint(1) NOT NULL DEFAULT '0'

```

I want to get the count of all entries with `correct = 1`, *and* the count of all entries with `correct = 0`, in *one* query.

How do I do this?

Answer: 
Using GROUP BY should solve the problem:

```
SELECT correct, COUNT(*) FROM table GROUP BY correct;

```
```
select count(case when correct = 0 then 1 end) as ZeroCount,
    count(case when correct = 1 then 1 end) as OneCount
from MyTable

```