title: count number of times a value appears in a column not GROUP BY in SQL
body: <p>Let us assume one has the following table (without the <strong>CountX</strong> column) :</p>
  <pre><code>| **ID** | **Name** | **City** | **CountX** | 
  
  | 1 | Ana | London | 1 |
  
  | 2 | Ana | Paris | 1 |
  
  | 3 | Mary | Paris | 2 |
  
  | 4 | Mary | Paris | 2 | 
  
  | 5 | John | London | 2 |
  
  | 6 | John | London | 2 |
  </code></pre>
  <p>I would like to add the column 'CountX' with the number of different entries, per each combination of Name &amp; City.</p>
  <p>I tried to use ROW_NUMBER() but it does not work well:</p>
  <pre><code>ROW_NUMBER () OVER (PARTITION BY Name, City ORDER BY Name) AS CountX
  </code></pre>
  <p>I also tried to do a sub-query, using <code>select distinct Name from table GROUP BY Name</code> but could not</p>
  <p>Thank you in advance!</p>