code: @Override
      public int join(final OneSelect _oneSelect,
                      final SQLSelect _select,
                      final int _relIndex)
          throws EFapsException
      {
          // it must be evaluated if the attribute that is used as the base for the linkto is inside a child table
          final Attribute attr = this.type.getAttribute(this.attrName);
          if (attr == null) {
              LinkToSelectPart.LOG.error("Could not find an Attribute with name '{}' for type:{}", this.attrName,
                              this.type);
              throw new EFapsException(LinkToSelectPart.class, "joinNoAttribute");
          }
          Integer relIndex = _relIndex;
          if (attr != null && !attr.getTable().equals(this.type.getMainTable())) {
              final String childTableName = attr.getTable().getSqlTable();
              relIndex = _oneSelect.getTableIndex(childTableName, "ID", _relIndex, null);
              if (relIndex == null) {
                  relIndex = _oneSelect.getNewTableIndex(childTableName, "ID", _relIndex, null);
                  _select.leftJoin(childTableName, relIndex, "ID", _relIndex, "ID");
              }
          }
          Integer ret;
          final String tableName = attr.getLink().getMainTable().getSqlTable();
          final String column = attr.getSqlColNames().get(0);
          ret = _oneSelect.getTableIndex(tableName, column, relIndex, null);
          if (ret == null) {
              ret = _oneSelect.getNewTableIndex(tableName, column, relIndex, null);
              _select.leftJoin(tableName, ret, "ID", relIndex, column);
          }
          _select.column(ret, "ID");
          this.idColumnIndex = _select.getColumns().size();
          // select the type column if it has one
          if (attr.getLink().getMainTable().getSqlColType() != null) {
              _select.column(ret, attr.getLink().getMainTable().getSqlColType());
              this.typeColumnIndex = _select.getColumns().size();
          }
          return ret;
      }
docs: {@inheritDoc}