Rework joins a bit
Test for self joining tables