Hi, My situation is as follows:
I have two tables LLPSC01U.PSC_PSC_ESTA_V (Estate)& LLPSC01U.PSC_PSC_DIRY_V (Diary). The Diary contains many occurances of many events for estates. I want to report on a single event including cases where the event hasn't occured. I was wondering on the most efficient way of doing it. I currently have a single report with the following SQL:
however it's taking a long time to run and i think that this is bacause of the complex join. My other thought is to run it as two seperate queries:
and
with them being linked in the report itself. Because of the volumetrics i run these queries at night so am not able to time them.
I was wondering if anybody had any ideas about the best solution for this situation, i'm thinking that there's probably a better way of getting the data that i haven't thought of yet. Any suggestions will be appreciated...
Thanks
I have two tables LLPSC01U.PSC_PSC_ESTA_V (Estate)& LLPSC01U.PSC_PSC_DIRY_V (Diary). The Diary contains many occurances of many events for estates. I want to report on a single event including cases where the event hasn't occured. I was wondering on the most efficient way of doing it. I currently have a single report with the following SQL:
Code:
SELECT
COALESCE(STRIP(LLPSC01U.PSC_PSC_ESTA_V.SRNM) || ', ' || STRIP(COALESCE(LLPSC01U.PSC_PSC_ESTA_V.FRNM,'')) , STRIP(LLPSC01U.PSC_PSC_ESTA_V.SRNM) ),
date(DIRY_ALLOC.DIRY_TS)
FROM
LLPSC01U.PSC_PSC_ESTA_V LEFT OUTER JOIN LLPSC01U.PSC_PSC_DIRY_V DIRY_ALLOC ON LLPSC01U.PSC_PSC_ESTA_V.ESTA_COD=DIRY_ALLOC.ESTA_COD AND DIRY_ALLOC.EVNT_COD = 'CHFIRS'
however it's taking a long time to run and i think that this is bacause of the complex join. My other thought is to run it as two seperate queries:
Code:
SELECT
COALESCE(STRIP(LLPSC01U.PSC_PSC_ESTA_V.SRNM) || ', ' || STRIP(COALESCE(LLPSC01U.PSC_PSC_ESTA_V.FRNM,'')) , STRIP(LLPSC01U.PSC_PSC_ESTA_V.SRNM) )
FROM
LLPSC01U.PSC_PSC_ESTA_V
and
Code:
SELECT
LLPSC01U.PSC_PSC_ESTA_V.ESTA_COD,
date(LLPSC01U.PSC_PSC_DIRY_V.DIRY_TS)
FROM
LLPSC01U.PSC_PSC_ESTA_V,
LLPSC01U.PSC_PSC_DIRY_V
WHERE
( LLPSC01U.PSC_PSC_ESTA_V.ESTA_COD=LLPSC01U.PSC_PSC_DIRY_V.ESTA_COD )
AND (
LLPSC01U.PSC_PSC_DIRY_V.EVNT_COD = 'CHFIRS'
)
with them being linked in the report itself. Because of the volumetrics i run these queries at night so am not able to time them.
I was wondering if anybody had any ideas about the best solution for this situation, i'm thinking that there's probably a better way of getting the data that i haven't thought of yet. Any suggestions will be appreciated...
Thanks