title: using isnull on a column from a joined table
body: <p>I have the following 2 tables:</p>
  
  <pre><code> city_code  city_name
      1   Berlin
      2   Munich
      3   Bonn
      4   Frankfurt
  
  city_code   Customer_number
  1   A
  2   B
  1   C
  1   D
  3   E
  </code></pre>
  
  <p>The following code works and it gives me the number of customers for each city, but it gives me null for Frankfurt, because there are no customers:</p>
  
  <pre><code>select c.cityName, c.cityCode, isnull(s.customerCount,0)
  from cities as c
  left join
  (
  select city_code, count (customerNumber) as CustomerCount
  from subscribers
  group by city_code
  ) as s
  on c.cityCode = s.city_code
  group by cityName;
  </code></pre>
  
  <p>Now I want to do the same thing, but show 0 instead of a null. In order to do that I used the same code, but changed the first line to:</p>
  
  <pre><code>select c.cityName, c.cityCode, isnull(s.customerCount,0)
  </code></pre>
  
  <p>This doesn't work. I am working on an online environment (w3schools) which doesn't specify the error, only indicates that there is an error.</p>
  
  <p>I'd appreciate your help.</p>