I have a query problem with count. I want to have a column with the number of persons registered to the course.

So far, this is my query:

```
select
  courses.id, 
  name, 
  location, 
  capacity, 
  (
    SELECT count(courses_requests.IDcourse) 
    FROM courses_requests, courses
    WHERE courses_requests.IDcourse = courses.id AND status != "rejected"
  ) as Registered, 
  begin_date, 
  end_date,  
  price, 
  active
from courses

```

But this is giving me problems, it displays the same value for all rows, even if the course doesn't have persons registered in the course

E.G 

```
Capacity Registered
2        1
30       1

```