title: Recursiv table join based on several conditions
body: <p>I have a following audit table in my system:</p>
  
  <pre><code>+---+----------------+-------------+----------------+-----------------------+-----------+
  |ID |field           |checkpoint   |value1          |value2                 |created_by |
  +---+----------------+-------------+----------------+-----------------------+-----------+
  |1  |active          |0            |null            |1                      |user1      |
  |2  |person          |0            |null            |jonh                   |user1      |
  |4  |duration        |2            |01.01.1970 0:00 |01.01.1970 0:07        |user1      |
  |2  |field_update    |1            |0               |1                      |user2      |
  |1  |opened_by       |1            |null            |sam                    |user1      |
  |2  |work_note       |2            |null            |TEST                   |user2      |
  +---+----------------+-------------+----------------+-----------------------+-----------+
  </code></pre>
  
  <p>Values with the same ID are refer to one entity. This audit table tracks all changes within one entity. So I need to catch following entity: 
  when field = 'person' AND value2 = 'john', I need to get next update of this entity (ID). Looking on table it is line 4 (same ID and checkpoint = checkpoint + 1). So we need to count all IDs with mentioned condition by this ID and created_by field.</p>