if (options.hasOwnProperty('having')) {
        options.having = this.getWhereConditions(options.having, tableName, factory, options, false)
        if (subQuery) {
          subQueryItems.push(" HAVING " + options.having)
        } else {