SELECT *
FROM (
SELECT ROW_NUMBER() OVER(
PARTITION BY ZA40011_3.URIAGE_DENPYO_NO,ZA40011_3.URIAGE_DENPYO_ROW_NO
ORDER BY ZA40011_3.KAKUTEI_SURYO_CS,
ZA40011_3.KAKUTEI_SURYO_BL,
ZA40011_3.KAKUTEI_SURYO_BT,
ZA40011_3.SYUKKA_SHIJI_NO,
ZA40011_3.SYUKKA_SHIJI_ROW_NO DESC) LEV,
ZA40011_3 .*
FROM WT_001_ZA40011_22070_2 ZA40011_2,
WT_001_ZA40011_22070_3 ZA40011_3,
JT_GYOMU_URIAGE_DETAIL URIAGE_DETAIL
WHERE
ZA40011_2.KAISYA_CODE=URIAGE_DETAIL.KAISYA_CODE
AND ZA40011_2.URIAGE_DENPYO_NO=URIAGE_DETAIL.URIAGE_DENPYO_NO
AND ZA40011_2.URIAGE_DENPYO_ROW_NO=URIAGE_DETAIL.ROW_NO
AND URIAGE_DETAIL.KAISYA_CODE=ZA40011_3.KAISYA_CODE
AND URIAGE_DETAIL.URIAGE_DENPYO_NO=ZA40011_3.URIAGE_DENPYO_NO
AND URIAGE_DETAIL.ROW_NO=ZA40011_3.URIAGE_DENPYO_ROW_NO
AND ZA40011_3.KEPPIN_RIYU_CODE IS NOT NULL
)
WHERE LEV=1
— ORDER BY KAKUTEI_SURYO_CS DESC
FROM (
SELECT ROW_NUMBER() OVER(
PARTITION BY ZA40011_3.URIAGE_DENPYO_NO,ZA40011_3.URIAGE_DENPYO_ROW_NO
ORDER BY ZA40011_3.KAKUTEI_SURYO_CS,
ZA40011_3.KAKUTEI_SURYO_BL,
ZA40011_3.KAKUTEI_SURYO_BT,
ZA40011_3.SYUKKA_SHIJI_NO,
ZA40011_3.SYUKKA_SHIJI_ROW_NO DESC) LEV,
ZA40011_3 .*
FROM WT_001_ZA40011_22070_2 ZA40011_2,
WT_001_ZA40011_22070_3 ZA40011_3,
JT_GYOMU_URIAGE_DETAIL URIAGE_DETAIL
WHERE
ZA40011_2.KAISYA_CODE=URIAGE_DETAIL.KAISYA_CODE
AND ZA40011_2.URIAGE_DENPYO_NO=URIAGE_DETAIL.URIAGE_DENPYO_NO
AND ZA40011_2.URIAGE_DENPYO_ROW_NO=URIAGE_DETAIL.ROW_NO
AND URIAGE_DETAIL.KAISYA_CODE=ZA40011_3.KAISYA_CODE
AND URIAGE_DETAIL.URIAGE_DENPYO_NO=ZA40011_3.URIAGE_DENPYO_NO
AND URIAGE_DETAIL.ROW_NO=ZA40011_3.URIAGE_DENPYO_ROW_NO
AND ZA40011_3.KEPPIN_RIYU_CODE IS NOT NULL
)
WHERE LEV=1
— ORDER BY KAKUTEI_SURYO_CS DESC
© 版权声明
文章版权归作者所有,未经允许请勿转载。