@@ -526,9 +526,9 @@ private String getEventSelectIdentifiersByIdScheme(EventQueryParams params) {
526
526
sqlBuilder .append (
527
527
getIdSqlBasedOnIdScheme (
528
528
idSchemes .getCategoryOptionComboIdScheme (),
529
- "coc .uid as coc_identifier, " ,
530
- "coc .attributevalues #>> '{%s, value}' as coc_identifier, " ,
531
- "coc .code as coc_identifier, " ));
529
+ "coc_agg .uid as coc_identifier, " ,
530
+ "coc_agg .attributevalues #>> '{%s, value}' as coc_identifier, " ,
531
+ "coc_agg .code as coc_identifier, " ));
532
532
533
533
return sqlBuilder .toString ();
534
534
}
@@ -797,7 +797,7 @@ private String getEventSelectQuery(
797
797
.append ("au.username as " )
798
798
.append (COLUMN_EVENT_ASSIGNED_USER_USERNAME )
799
799
.append ("," )
800
- .append ("coc .uid as " )
800
+ .append ("coc_agg .uid as " )
801
801
.append (COLUMN_EVENT_ATTRIBUTE_OPTION_COMBO_UID )
802
802
.append (", " )
803
803
.append ("coc_agg.co_uids AS co_uids, " )
@@ -1501,13 +1501,11 @@ private String addLastUpdatedFilters(
1501
1501
*/
1502
1502
private String getCategoryOptionComboQuery (User user ) {
1503
1503
String joinCondition =
1504
- "inner join categoryoptioncombo coc on coc.categoryoptioncomboid = ev.attributeoptioncomboid "
1505
- + " inner join lateral (select coc.categoryoptioncomboid as id,"
1504
+ " inner join (select coc.uid, coc.attributevalues, coc.code, coc.categoryoptioncomboid as id,"
1506
1505
+ " string_agg(co.uid, ',') as co_uids, count(co.categoryoptionid) as co_count"
1507
1506
+ " from categoryoptioncombo coc "
1508
1507
+ " inner join categoryoptioncombos_categoryoptions cocco on coc.categoryoptioncomboid = cocco.categoryoptioncomboid"
1509
1508
+ " inner join categoryoption co on cocco.categoryoptionid = co.categoryoptionid"
1510
- + " where ev.attributeoptioncomboid = coc.categoryoptioncomboid"
1511
1509
+ " group by coc.categoryoptioncomboid " ;
1512
1510
1513
1511
if (!isSuper (user )) {
0 commit comments