@Override @Deprecated public final Field<Integer> countDistinct() { return DSL.countDistinct(this); }
@Override @Deprecated public final Field<Integer> countDistinct() { return DSL.countDistinct(this); }
private static final AggregateFunction<?> parseCountIf(ParserContext ctx) { if (parseFunctionNameIf(ctx, "COUNT")) { parse(ctx, '('); boolean distinct = parseSetQuantifier(ctx); if (parseIf(ctx, '*') && parse(ctx, ')')) if (distinct) return countDistinct(); else return count(); QualifiedAsterisk asterisk = parseQualifiedAsteriskIf(ctx); List<Field<?>> fields = (asterisk == null) ? distinct ? parseFields(ctx) : Collections.<Field<?>>singletonList(parseField(ctx)) : null; parse(ctx, ')'); if (distinct) if (fields == null) return countDistinct(asterisk); else if (fields.size() > 0) return countDistinct(fields.toArray(EMPTY_FIELD)); else return countDistinct(fields.get(0)); else if (fields == null) return count(asterisk); else return count(fields.get(0)); } return null; }
@Override public int numItemsWithPreferences() { return dsl .select(DSL.countDistinct(IIDX)) .from(DATA) .fetchOne().value1(); }
@Override public int numUsersWithPreferences() { return dsl .select(DSL.countDistinct(UIDX)) .from(DATA) .fetchOne().value1(); }
public int customizedCount(ConditionSortLimit conditions) { Condition condition = conditions.getCondition(); SelectSelectStep<Record1<Integer>> count; if (this.pkColumn != null && !this.pkColumn.isEmpty()) { count = this.create.select(DSL.countDistinct(DSL.field(tableAlias.append(this.pkColumn)))); } else { count = this.create.selectCount(); } SelectJoinStep<Record1<Integer>> select; if (condition == null) { select = count.from(this.table.as(tableAlias)); } else { select = count.from(this.joinedTable); select = joinTables(select, conditions); } return customizedCount(select, condition); }
countDistinct(a.HOST), sum(when(a.STATUS.eq(RUNNING.name()), 1).otherwise(0)).as(RUNNING.name()), sum(when(a.STATUS.eq(CHANGED.name()), 1).otherwise(0)).as(CHANGED.name()),