|
||||||||||||||||||
0
0
º½-º½
ÀÌ·±°Ç Æã¼ÇÀ¸·Î ±¸ÇöÇÏ´Â°Ô ÀϹÝÀûÀε¥..±»ÀÌ ²À Çѹæ select·Î ÇÏ°í ½Í´Ù¸é...
WITH SAMPLE_DATA AS ( SELECT '1' AS SEQ, 'aa' AS AA, '' AS BB, 'cc' AS CC, '' AS DD FROM DUAL UNION ALL SELECT '2' AS SEQ, 'aa' AS AA, 'bb' AS BB, '' AS CC, '' AS DD FROM DUAL UNION ALL SELECT '3' AS SEQ, 'aa' AS AA, '' AS BB, '' AS CC, 'dd' AS DD FROM DUAL ) ,TMP AS ( SELECT NVL2(AA,1000,0) + NVL2(BB,100,0) + NVL2(CC,10,0) + NVL2(DD,1,0) AS RANK_VALUE ,SEQ FROM SAMPLE_DATA ) SELECT CASE WHEN BB IS NULL THEN AA WHEN CC IS NULL THEN BB WHEN DD IS NULL THEN CC ELSE DD END AS RESULT_VALUE FROM SAMPLE_DATA A WHERE SEQ = ( SELECT MAX(SEQ) KEEP(DENSE_RANK LAST ORDER BY RANK_VALUE) AS RESULT_RNUM FROM TMP ) |
0
0
ciwciw
Select NVL2(AA, 10000000, 0) + NVL2(BB, 1000000, 0) + NVL2(CC, 100000, 0) + NVL2(DD, 10000, 0) + NVL2(EE, 1000, 0) + NVL2(FF, 100, 0) + NVL2(GG, 10, 0) + NVL2(HH, 1, 0)
From DataTable Order by NVL2(AA, 10000000, 0) + NVL2(BB, 1000000, 0) + NVL2(CC, 100000, 0) + NVL2(DD, 10000, 0) + NVL2(EE, 1000, 0) + NVL2(FF, 100, 0) + NVL2(GG, 10, 0) + NVL2(HH, 1, 0) desc |
|
|
¡â ÀÌÀü±Û¡ä ´ÙÀ½±Û | ¸ñ·Ïº¸±â |
ù¹ø°´Â 1000, µÎ¹ø¤Š´Â 100 ¼¼¹ø° 10....
ÀÌ·±½ÄÀ¸·Î ÇÏ¸é µÉµí...