2024-04-15 지역배정 쿼리 수정

This commit is contained in:
myname 2024-04-15 18:25:12 +09:00
parent a5375b6db6
commit f64887c53f

View File

@ -709,9 +709,38 @@
, regexp_substr(NVL(b.two_depth_nm, b.three_depth_nm), '[^ ]+',1,1) AS two_depth_nm
FROM ve_lctr_area a
, ve_rsdnc b
, ve_rsdnc b
, (
SELECT
bb.user_id, bb.lctr_stng_ord
FROM
(
SELECT
a.user_id
, stng_yr_mnt
, RANK() OVER(PARTITION BY a.user_id ORDER BY stng_yr_mnt DESC) AS rnk
FROM
ve_lctr_rsrch_sbmt a
WHERE a.user_id IN ($userIds$)
)aa
, ve_lctr_rsrch_sbmt bb
WHERE
1 >= aa.rnk
AND aa.user_id=bb.user_id
AND aa.stng_yr_mnt=bb.stng_yr_mnt
AND bb.instr_div='10'
)ccc
WHERE a.AREA_CD =b.POST_ID
AND a.user_id IN ($userIds$)
AND ccc.user_id=a.user_id
AND ccc.lctr_stng_ord=a.lctr_stng_ord
/*
AND a.user_id IN (userIds)
*/
)aa
GROUP BY aa.user_id
, aa.one_depth_nm