title: count user from different districts by selected age
body: <p>I am trying to write mysql query that would get me the data about the count of users in my different districts by some selcted age . 
  for example : if i choose age 0-14 i want to get how many users from 'north' ,'south' and etc are between age 0 and 14. </p>
  
  <p>i'm writing the current query : </p>
  
  <pre><code>SELECT sum(case when districts.`districtId` = 1 then 1 else 0 end) as 'North',
      sum(case when districts.`districtId` = 4 then 1 else 0 end) as 'Center',
      sum(case when  districts.`districtId` = 6 then 1 else 0 end) as 'South', , (DATE_FORMAT(NOW(), '%Y') - DATE_FORMAT(userDetails.birthDate2, '%Y') - (DATE_FORMAT(NOW(), '00-%m-%d') &lt; DATE_FORMAT(userDetails.birthDate2, '00-%m-%d'))) as age
  </code></pre>
  
  <p>from .... where age between 0 and 14 
  but i get the error : unknown age column. 
  is there other way to write this query ?!</p>