code: public String getSQL()
      {
          final StringBuilder cmd = new StringBuilder().append(" ")
              .append(Context.getDbType().getSQLPart(SQLPart.SELECT)).append(" ");
          if (distinct) {
              cmd.append(Context.getDbType().getSQLPart(SQLPart.DISTINCT)).append(" ");
          }
          boolean first = true;
          for (final Column column : columns) {
              if (first) {
                  first = false;
              } else {
                  cmd.append(Context.getDbType().getSQLPart(SQLPart.COMMA));
              }
              column.appendSQL(cmd);
          }
          cmd.append(" ").append(Context.getDbType().getSQLPart(SQLPart.FROM)).append(" ");
          first = true;
          for (final FromTable fromTable : fromTables) {
              fromTable.appendSQL(first, cmd);
              if (first) {
                  first = false;
              }
          }
          cmd.append(" ");
          boolean whereAdded = false;
          for (final SQLSelectPart part : parts) {
              part.appendSQL(cmd);
              cmd.append(" ");
              whereAdded = whereAdded || !whereAdded && SQLPart.WHERE.equals(part.sqlpart);
          }
  
          if (where != null) {
              where.setStarted(whereAdded);
              where.appendSQL(tablePrefix, cmd);
          }
  
          if (order != null) {
              order.appendSQL(tablePrefix, cmd);
          }
          return cmd.toString();
      }
docs: Returns the depending SQL statement.
  
  @return SQL statement