code: public String getSQLStatement(final Integer _idx)
          throws EFapsException
      {
          prepareQuery();
          final SQLSelect select = new SQLSelect("S" + _idx + "T")
              .column(getSqlTable2Index().get(this.attribute.getTable()), this.attribute.getSqlColNames().get(0))
              .from(getBaseType().getMainTable().getSqlTable(), 0);
  
          // add child tables
          if (getSqlTable2Index().size() > 0) {
              for (final Entry<SQLTable, Integer> entry : getSqlTable2Index().entrySet()) {
                  if (entry.getValue() > 0) {
                      select.leftJoin(entry.getKey().getSqlTable(), entry.getValue(), "ID", 0, "ID");
                  }
              }
          }
          select.addSection(getWhere());
          select.addSection(getOrderBy());
          select.addSection(getLimit());
  
          if (AbstractObjectQuery.LOG.isDebugEnabled()) {
              AbstractObjectQuery.LOG.debug(select.getSQL());
          }
          return select.getSQL();
      }
docs: Create the SQL statement.
  
  @param _idx the _idx
  @return StringBuilder containing the statement
  @throws EFapsException on error