title: How can I specify the where clause when combining multiple tables?
body: <p>I have a query that should count all of my specified rows. This is my query:</p>
  
  <pre><code>SELECT COUNT(*) AS Som
       FROM users
       RIGHT JOIN stoftesten ON users.username = stoftesten.gebruikersid
       RIGHT JOIN eindgesprekken ON users.username = eindgesprekken.gebruikersid
       RIGHT JOIN rapportages ON users.username = rapportages.gebruikersid
       WHERE users.rol = 'geleider' and users.basis = '1' and stoftesten.status = 'Niet beoordeeld' or eindgesprekken.status = 'Niet beoordeeld' or rapportages.status = 'Niet beoordeeld';
  </code></pre>
  
  <p>I should get the number 2, because thats the amount of records I have according to the query I want, but it gives me 40. What am I doing wrong here?</p>
  
  <p>Tables:</p>
  
  <p><strong>users</strong></p>
  
  <pre><code>-------------------------------------------
  | username (PK) | basis | rol      | name |
  -------------------------------------------
  | user01        | VLB   | geleider | Ben  |
  | user02        | GER   | geleider | Tom  |
  -------------------------------------------
  </code></pre>
  
  <p><strong>stoftesten</strong></p>
  
  <pre><code>-------------------------------------------
  | id (PK) | gebruikersid (FK:id) | status |
  -------------------------------------------
  | 1       | user01   | Niet beoordeeld    |
  | 2       | user01   | Beoordeeld         |
  -------------------------------------------
  </code></pre>
  
  <p><strong>rapportages</strong></p>
  
  <pre><code>-------------------------------------------
  | id (PK) | gebruikersid (FK:id) | status |
  -------------------------------------------
  | 1       | user01   | Beoordeeld         |
  | 2       | user01   | Beoordeeld         |
  -------------------------------------------
  </code></pre>
  
  <p><strong>eindgesprekken</strong></p>
  
  <pre><code>-------------------------------------------
  | id (PK) | gebruikersid (FK:id) | status |
  -------------------------------------------
  | 1       | user01   | Niet beoordeeld    |
  | 2       | user01   | Beoordeeld         |
  -------------------------------------------
  </code></pre>
  
  <p>I want the query to select the records from 'stoftesten', 'eindgesprekken' and 'rapportages' where the status is 'Niet beoordeeld' and the user basis is 'VLB'. Then I want to count these rows and get a number. in this case, I want to see the number 2.</p>