From 2dc75d60454a7e5528f0ed52aa9189d033bcce7d Mon Sep 17 00:00:00 2001 From: hilary egesa Date: Thu, 1 Aug 2024 09:40:24 +0300 Subject: [PATCH] migrate selectManyWithRowBounds to using subquery --- .../mapper/custom/xml/CustomEventMetadataMapper.xml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomEventMetadataMapper.xml b/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomEventMetadataMapper.xml index 5ceaf5d08..48583277e 100644 --- a/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomEventMetadataMapper.xml +++ b/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomEventMetadataMapper.xml @@ -151,17 +151,18 @@ distinct - from core.event_metadata em - inner join core.event e on em.event_id = e.id + from core.event e + where e.id in (select em.event_id from core.event_metadata em - + ) - order by em.${example.orderByClause} + order by ${example.orderByClause} LIMIT #{limit} OFFSET #{offset} +