title: Creating Breadcrumbs structure from SQL Query
body: <p>I am using SQL Query and below are the tables.</p>
  
  <p><strong>Organization</strong></p>
  
  <pre><code>OrgID    Name          RAOGID     RAOID   SubGroupID
  1       Org RAOG      1   NULL       NULL
  2       Org RAO         NULL       1        NULL
  3       Org Sub Group   NULL       NULL      1
  </code></pre>
  
  <p><strong>RAOG</strong></p>
  
  <pre><code>RAOGID  AccredID
  1              2  
  </code></pre>
  
  <p><strong>RAO</strong></p>
  
  <pre><code>RAOID   RAOGID
  1         1
  </code></pre>
  
  <p><strong>Sub Group</strong></p>
  
  <pre><code>SubGroupID  RAOID
  1            1
  </code></pre>
  
  <p>I have four tables as shown above, I need to make breadcrumb from above table’s structure, so I want to write query which will return the data in below format, please see below.</p>
  
  <p><strong>RAOGID >> RAOID >> SubGroupID</strong></p>
  
  <p>For example from above data my breadcrumb will be</p>
  
  <p><strong>Org RAOG >> Org RAO >> Org Sub Group</strong></p>
  
  <p>The “Organization” table contains all the IDs of ROAG, RAO and SubGroup, I need the query which will return the data in above format.</p>
  
  <p>One more functionality is required. I don't want to show the breadcrumb if there is no subgroupid so my breadcrumb will be <strong>Org RAOG >> Org RAO</strong> and there is no RAOID then there will be only one breadcrumd i.e. <strong>Org RAOG</strong></p>
  
  <p>Thanks,
  Best Regards,
  Manoj</p>