title: Retrieve a complete list of all Categories, Sub Categories, Sub Sub Categories, etc. in only one SQL query
body: <p>I have following table structure and data in MySQL</p>
  
  <pre><code>CatID  CatName     ParentCatID
  -------------------------------
  1       Shirts        NULL
  2       Short Sleev    1
  3       Long Sleev     1
  4       Collarless     2
  5       Collar         2
  6       Collarless     3
  7       Collar         3
  8       Square Cut     4
  9       Round Cut      4
  10      Square Cut     6
  11      Round Cut      6
  </code></pre>
  
  <p>Return data that I want is something like this:</p>
  
  <pre><code>Shirts &gt; Short Sleev
  Shirts &gt; Long Sleev
  Shirts &gt; Short Sleev &gt; Collarless
  Shirts &gt; Short Sleev &gt; Collar
  Shirts &gt; Long Sleev &gt; Collarless
  Shirts &gt; Long Sleev &gt; Collar
  Shirts &gt; Short Sleev &gt; Collarless &gt; Square Cut
  Shirts &gt; Short Sleev &gt; Collarless &gt; Round Cut
  Shirts &gt; Short Sleev &gt; Collar &gt; Square Cut
  Shirts &gt; Short Sleev &gt; Collar &gt; Round Cut
  </code></pre>
  
  <p>How can we get these data using one single SQL query in MySQL?</p>