![]() |
|
Archives of the TeradataForumMessage Posted: Fri, 11 Aug 2006 @ 21:56:11 GMT
Dear All, I am trying to modifying the following query
Select
CLM_LN_ADJMT_KEY, CLM_LN_SRVC_STRT_DT,
SRC_DW_CD, CLM_SRC_SYS_CD,
CLM_NBR, CLM_LN_NBR, MBR_KEY,
CLM_LN_ADJMT_NBR,
max (CLM_LN_ADJMT_NBR)
OVER (PARTITION BY CLM_NBR, CLM_LN_NBR, SRC_DW_CD, CLM_SRC_SYS_CD, MBR_KEY
ORDER BY CLM_NBR,CLM_LN_NBR) MAX_ADJ_NBR
From
DFLT_CLM_GTT
Where
SRC_DW_CD = :src_dw_cd_in
and clm_disp_cd = 'READJ'
The above query needs to be modified to perform the following It should test for the condition clm_disp_cd = 'READJ' only when there are duplicate adjustment number for the same claim line i.e. If the below group by clause
Group By Clause SRC_DW_CD, CLM_SRC_SYS_CD, CLM_NBR, CLM_LN_NBR,
MBR_KEY, CLM_LN_ADJMT_NBR
returns more than 1 unique records, then use the following query
Select
CLM_LN_ADJMT_KEY, CLM_LN_SRVC_STRT_DT,
SRC_DW_CD, CLM_SRC_SYS_CD,
CLM_NBR, CLM_LN_NBR, MBR_KEY,
CLM_LN_ADJMT_NBR,
max (CLM_LN_ADJMT_NBR)
OVER (PARTITION BY CLM_NBR, CLM_LN_NBR, SRC_DW_CD, CLM_SRC_SYS_CD, MBR_KEY
ORDER BY CLM_NBR,CLM_LN_NBR) MAX_ADJ_NBR
From
DFLT_CLM_GTT
Where
SRC_DW_CD = :src_dw_cd_in
and clm_disp_cd = 'READJ'
If the group by clause return only one unique record, then use the following query
Select
CLM_LN_ADJMT_KEY, CLM_LN_SRVC_STRT_DT,
SRC_DW_CD, CLM_SRC_SYS_CD,
CLM_NBR, CLM_LN_NBR, MBR_KEY,
CLM_LN_ADJMT_NBR,
max (CLM_LN_ADJMT_NBR)
OVER (PARTITION BY CLM_NBR, CLM_LN_NBR, SRC_DW_CD, CLM_SRC_SYS_CD, MBR_KEY
ORDER BY CLM_NBR,CLM_LN_NBR) MAX_ADJ_NBR
From
DFLT_CLM_GTT
Where
SRC_DW_CD = :src_dw_cd_in
Sincere Thanks, Pratheesh
| ||||||||||||||||||||||||||||||||||||||||||||||||
| | ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||
| Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
| Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||