title: Join itself where parent date between child dates
body: <p>I am struggling with building a query that would take some rows from a table by IDs and then join rows from the same table where <code>start_date</code> and <code>end_date</code> are between parent <code>start_date</code>. Consider table like</p>
  
  <p>events</p>
  
  <pre><code>| id | event_type_id | start_date | end_date |
  | 1 | 1 | 10 | 100 |
  | 2 | 2 | 5 | 20 |
  | 3 | 2 | 8 | 50 |
  </code></pre>
  
  <p>Events with <code>event_type_id</code> = 1 are like normal events while the ones with =2 are period events. I'd like to build query so I get all normal events, but along with period events that <code>start_date</code> and <code>end_date</code> are between normal event <code>start_date</code>. So considering example above I want to get event with <code>id</code> of 1 and join events with <code>event_type_id</code> of 2 with <code>start_date</code> and <code>end_date</code> between 10. Note that even though there is only 1 record with <code>event_type_id</code>=1 there would be more of them and I want to take all of them in one query. I know it is easy to do for single record, but I'd like to fetch like a whole tree of this so I won't end up with n+1. Is it even possible or should I think about different approach ?</p>