if( countOnly )
{
mainColumn = c.colExp( l.func( SQLFunctions.COUNT, mainColumn ) );
}
QueryBuilder innerBuilder = this.processBooleanExpression(
whereClause, false, vendor,
this.createTypeCondition( resultType, vendor ), variables, values, valueSQLTypes );
QuerySpecificationBuilder mainQuery = q.querySpecificationBuilder();
mainQuery.getSelect().addUnnamedColumns( mainColumn );
mainQuery.getFrom().addTableReferences(
t.tableBuilder( t.table( q.createQuery( innerBuilder.createExpression() ),
t.tableAlias( TABLE_NAME_PREFIX + "0" ) ) ) );
this.processOrderBySegments( orderBySegments, vendor, mainQuery );
QueryExpression finalMainQuery = this.finalizeQuery(