code: function outputQuery(compiled, isParameter) {
      var sql = compiled.sql || '';
      if (sql) {
        if (compiled.method === 'select' && (isParameter || compiled.as)) {
          sql = '(' + sql + ')';
          if (compiled.as) {
            return this.alias(sql, this.wrap(compiled.as));
          }
        }
      }
      return sql;
    }
docs: Ensures the query is aliased if necessary.