title: SQL join for selecting two records with common data
body: <p>I have database with this type of records: </p>
  
  <pre><code>Id     | Value  | DocId |
  ------ | ------ | ------|
  1      |  10    |  null |
  2      | -10    |  1    |  //this is child of record with id = 1
  3      |  15    |  null |
  4      | -15    |  3    |  //this is child of record with id = 3
  5      |  7     |  null |
  6      | -7     |  5    |  //this is child of record with id = 5 
  7      | 16     |  null |
  </code></pre>
  
  <p>So I want to select the records where <code>Id = 1</code> and <code>Id = DocId</code>, so this should return (because those are the records with <code>Id = 1</code> and <code>DocId = 1</code>)</p>
  
  <pre><code>Id     | Value  | DocId |
  ------ | ------ | ------|
  1      | 10     |  null |
  2      | -10    |  1    |
  </code></pre>
  
  <p>I know I can use a where clause but I need to do it with Join.</p>