Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query optimization

Status
Not open for further replies.

jfkuser

Programmer
Mar 12, 2003
3
US
Is there any way we can rewrite this query to run faster in DB2 7.2 :

INSERT INTO SESSION.TEMP_CLMCNT03
(
SELECT TMP_CLM.CLM_ID
,MIN(TMP_CLM.CLM_CVRG_ID)
,TMP_CLM.PROC_DT
FROM SESSION.TEMP_CLMCNT02 TMP_CLM
WHERE NOT EXISTS (
SELECT 1
FROM SESSION.TEMP_CLMCNT02 TMP_CLM1
WHERE TMP_CLM1.CLM_ID = TMP_CLM.CLM_ID
AND TMP_CLM1.PROC_DT = TMP_CLM.PROC_DT
AND TMP_CLM1.SRC_SYS_PROD_CD = TMP_CLM.SRC_SYS_PROD_CD
AND TMP_CLM1.RANK < TMP_CLM.RANK
)
GROUP BY TMP_CLM.CLM_ID
,TMP_CLM.SRC_SYS_PROD_CD
,TMP_CLM.PROC_DT
)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top