Select distinct ordered pairs from table join grouped by event's most recent date
<p>Following the post <a href="https://stackoverflow.com/questions/39157850/select-distinct-ordered-pair-from-table-join">Select distinct ordered pair from table join</a>  </p>

<p>How can I select the most recent John's joined rows grouped by ordered pair, regardless the order (e.g. John -> Jane or Jane -> John)?</p>

<p>First table:</p>

<pre><code>table_a
+-----------+--------------+-------------------+
|    id     |     name     |     created_at    |
+-----------+--------------+-------------------+
|     1     |     John     |2016-08-26 15:40:21|
+-----------+--------------+-------------------+
|     2     |     Jane     |2016-08-26 15:37:21|
+-----------+--------------+ ------------------+
|     3     |     Jane     |2016-08-26 15:38:21|
+-----------+--------------+-------------------+
|     4     |     Tara     |2016-08-26 15:39:21|
+-----------+--------------+-------------------+   
</code></pre>

<p>Second Table:</p>

<pre><code>table_b
+-----------+-------------------+-------------+-------------+
|    id     |     id_table_a    |    name     |   message   |
+-----------+-------------------+-------------+-------------+
|    1      |          1        |    Jane     |   Test 1    |
+-----------+-------------------+-------------+-------------+
|    2      |          2        |    John     |   Test 2    |
+-----------+-------------------+-------------+-------------+
|    3      |          3        |    Sammy    |   Test 3    |
+-----------+-------------------+-------------+-------------+
|    4      |          4        |    John     |   Test 4    |
+-----------+-------------------+-------------+-------------+
</code></pre>

<p>One possible result</p>

<pre><code>+-----------+-------------+-------------+-------------+-------------------+
|    id     |   name_a    |   name_b    |   message   |     created_at    |
+-----------+-------------+-------------+-------------+-------------------+
|    1      |   John      |   Jane      |   Test 1    |2016-08-26 15:40:21|
+-----------+-------------+-------------+-------------+-------------------+
|    4      |   Tara      |   John      |   Test 4    |2016-08-26 15:39:21|
+-----------+-------------+-------------+-------------+-------------------+
</code></pre>

<p><a href="http://sqlfiddle.com/#!9/88af9" rel="nofollow noreferrer">sqlfiddle</a>  </p>

<p>Thanks a lot!</p>