Added a condition for when joining tables on themselves it skips referenceing the table id.