This simple query:

```
select exam.id as exam_id,
(select count(*) from dataset where dataset.id = exam.id) as n_dataset
from exam
where n_dataset = 0

```

returns the following error:

```
ERROR 1054 (42S22) at line 1: Unknown column 'n_dataset' in 'where clause'

```

Why?