title: hierarchical Query in Snowflake
body: <p>I am trying to build the child relationship for the Bill of material Explosion in Snowflake with below dataset.How to get the levels for maintaining the parent &amp; child relationship using connect by prior clause in snowflake.With the two table as input for this output
  <a href="https://i.stack.imgur.com/CaTrh.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CaTrh.jpg" alt="enter image description here"></a></p>
  
  <pre><code>PPBOM PPMAT PMAT LEVEL COMPONENT 
  bom1  1001  1001 1     1002 
  bom1  1001  1001 1     1003 
  bom1  1001  1001 1     1004 
  bom1  1001  1001 1     1005 
  bom1  1001  1002 2     1009 
  bom1  1001  1002 2     1010 
  bom1  1001  1009 3     1011 
  bom1  1001  1009 3     1012
  </code></pre>