title: Get full tree of parent/child relationships in mysql of any node in the tree with all parents
body: <p>Example data:</p>
  
  <pre><code>+----+-------+----------+
  | org_id | Name  | ParentID |
  +----+-------+----------+
  |  1 | Org1  | 2        |
  |  2 | Org2  | NULL     |
  |  3 | Org3  | 5        |
  |  5 | Org5  | 1        |
  | 14 | Org14 | 1        |
  +----+-------+----------+
  </code></pre>
  
  <p>If I am logged in as user with org_id 1 (Org1). I want to retrieve the full tree of that user. </p>
  
  <p>I have the following recursive Query :</p>
  
  <pre><code>WITH RECURSIVE cte (org_id, name, parent_id) AS (
       SELECT org_id, name, parent_id
       FROM organization
       WHERE org_id = 1
       UNION ALL
       SELECT t1.org_id, t1.name, t1.parent_id
       FROM organization t1
       INNER JOIN cte t2 ON t1.parent_id = t2.org_id
  )
  SELECT * FROM cte;
  </code></pre>
  
  <p>However, this query only gives me the children of the current id (Org1 in this example). How can I include all the parents as well in the result set, so I can rebuild the entire tree accurately? </p>
  
  <p>EDIT: I am using MariaDB version 10.4.10</p>
  
  <p>EDIT:
  I tried the query as in the answer below, i'm getting a syntax error :
  <a href="https://i.stack.imgur.com/rFNYz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rFNYz.png" alt="syntax error"></a></p>