diff --git a/src/main/java/com/epam/ta/reportportal/commons/querygen/FilterTarget.java b/src/main/java/com/epam/ta/reportportal/commons/querygen/FilterTarget.java index 5a48af6ee..ef8356611 100644 --- a/src/main/java/com/epam/ta/reportportal/commons/querygen/FilterTarget.java +++ b/src/main/java/com/epam/ta/reportportal/commons/querygen/FilterTarget.java @@ -443,11 +443,11 @@ protected void addFrom(SelectQuery query) { @Override protected void joinTables(QuerySupplier query) { - query.addJoin(PROJECT_USER, JoinType.LEFT_OUTER_JOIN, USERS.ID.eq(PROJECT_USER.USER_ID)); + query.addJoin(ORGANIZATION_USER, JoinType.LEFT_OUTER_JOIN, ORGANIZATION_USER.USER_ID.eq(USERS.ID)); + query.addJoin(ORGANIZATION, JoinType.LEFT_OUTER_JOIN, ORGANIZATION.ID.eq(ORGANIZATION_USER.ORGANIZATION_ID)); + + query.addJoin(PROJECT_USER, JoinType.LEFT_OUTER_JOIN, ORGANIZATION_USER.USER_ID.eq(PROJECT_USER.USER_ID)); query.addJoin(PROJECT, JoinType.LEFT_OUTER_JOIN, PROJECT_USER.PROJECT_ID.eq(PROJECT.ID)); - query.addJoin(ORGANIZATION, JoinType.LEFT_OUTER_JOIN, ORGANIZATION.ID.eq(PROJECT.ORGANIZATION_ID)); - query.addJoin(ORGANIZATION_USER, JoinType.LEFT_OUTER_JOIN, - ORGANIZATION_USER.ORGANIZATION_ID.eq(PROJECT.ORGANIZATION_ID).and(USERS.ID.eq(ORGANIZATION_USER.USER_ID))); } @Override