title: Count descendant rows in a table tree
body: <p>We have a table with tree structure like this:</p>
  
  <pre><code>Id  Desc  ParentID
  ===
  A    DescrA   NULL
  B    DescrB   A
  C    DescrC   A
  D    DescrD   C
  E    DescrE   C
  F    DescrF   E
  </code></pre>
  
  <p>We need a query that returns the number of descendants (including subdescendants) of a specific ID, something like:</p>
  
  <pre><code>select count(descendants) from Tablex where id='A' --result = 5
  select count(descendants) from Tablex where id='B' --result = 0
  select count(descendants) from Tablex where id='C' --result = 3
  select count(descendants) from Tablex where id='E' --result = 1
  </code></pre>
  
  <p>We have seen it would be made 'easily' with CTE but couldnt get the gist of it...</p>