Need to aggregate a boolean column value in sleep mode

I have a table with one of the columns as a boolean type, and I need a usage group by projecting onto another column. Now I want all the columns in the selection list. Therefore, I need to use the aggregate function for all columns.

What should be used in case of boolean type column?

+3
source share
1 answer

Aggregates in Hibernate map directly to the appropriate aggregate group in SQL, so the answer is based on which SQL aggregation function you would apply to a Boolean column if you were to write the query directly in SQL.

Projections . count, , , . , , , , , , - .

AggregateProjection, SQL, . , (, STDDEV_POP), SQL, SQL-. , (true, - ), -

if(sum(if(boolean_column,1,0))>0,true,false)

, toSqlString . , - Projections.

, , , , Hibernate, getColumnAlias ​​AggregateProjection.

0

All Articles