title: oracle connect by multiple parents
body: <p>I am facing an issue using connect by.</p>
  
  <p>I have a query through which I retrieve a few columns including these three:</p>
  
  <ul>
  <li>ID</li>
  <li>ParentID</li>
  <li>ObjectID</li>
  </ul>
  
  <p>Now for the same <code>ID</code> and <code>parentID</code>, there are multiple objects associated e.g.</p>
  
  <p>ID ParentID ObjectID<br>
  1 &nbsp;&nbsp;   0 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;         112<br>
  1 &nbsp;&nbsp;   0 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;         113<br>
  2 &nbsp;&nbsp;   0 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;         111<br>
  2 &nbsp;&nbsp;   0 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;         112<br>
  3 &nbsp;&nbsp;   1 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;         111<br>
  4 &nbsp;&nbsp;   1 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;         112<br></p>
  
  <p>I am trying to use <code>connect by</code> but I'm unable to get the result in a proper hierarchy. I need it the way it is showed below. Take an <code>ID</code>-<code>parentID</code> combo, display all rows with that <code>ID-parentID</code> and then all the children of this <code>ID</code> i.e. whose <code>parentID</code>=<code>ID</code>
  <br>
  <br>
  ID ParentID ObjectID<br>
  1 &nbsp;&nbsp;   0 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;         112<br>
  1 &nbsp;&nbsp;   0 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;         113<br>
  3 &nbsp;&nbsp;   1 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;         111<br>
  4 &nbsp;&nbsp;   1 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;         112<br>
  2 &nbsp;&nbsp;   0 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;         111<br>
  2 &nbsp;&nbsp;   0 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;         112<br></p>
  
  <pre><code>select ID,parent_id, object_id from table start with parent_id=0 
  connect by prior id=parent_id order by id,parent_id
  </code></pre>
  
  <p>Above query is not resulting into proper hierarchy that i need.</p>