17,380
社区成员
发帖
与我相关
我的任务
分享
select A,B,
(select D fron table where (t.A='1' and number=100) or (t.A='2' and number=200))
from table_name t
;
SQL> select * from tt;
VAL
----------
1
2
3
100
SQL>
SQL> SELECT decode(tt.val, 1, 'one', 2, 'two', 3, 'three', 'other') FROM tt;
DECODE(TT.VAL,1,'ONE',2,'TWO',
------------------------------
one
two
three
other
SQL> SELECT CASE
2 WHEN tt.val = 1 THEN
3 'one'
4 WHEN tt.val = 2 THEN
5 'two'
6 WHEN tt.val = 3 THEN
7 'three'
8 ELSE
9 'other'
10 END
11 FROM tt;
CASEWHENTT.VAL=1THEN'ONE'WHENT
------------------------------
one
two
three
other
SQL>
select A ,B, (select D from table where number= A*100) as C from F