Oracle SQL でdecode関数のorder byの使い方

SQL構文
SELECT kotost.adv_cd
FROM mg_ kotost kotost
ORDER BY decode(kotost.adv_cd,
‘COST’,
1,
‘INCOME’,
2,
3) ASC;

実行結果
17 COST
18 COST
19 COST
20 INCOME
21 INCOME
22 INCOME

Comments are closed.