select
case when t1.col1 >t2.col1 and t1.col1<t2.col2 then
t1.col2 || ' belongs to ' ||t2.col3
end belong
from table1 t1, table2 t2
where t1.col1 >t2.col1 and t1.col1<t2.col2
BELONG
--------------------------------------------------------------------------------
A belongs to C
B belongs to D
case when t1.col1 >t2.col1 and t1.col1<t2.col2 then
t1.col2 || ' belongs to ' ||t2.col3
end belong
from table1 t1, table2 t2
where t1.col1 >t2.col1 and t1.col1<t2.col2
BELONG
--------------------------------------------------------------------------------
A belongs to C
B belongs to D
t1.col2 || ' belongs to ' ||t2.col3 as belong
from table1 t1, table2 t2
where t1.col1 >t2.col1 and t1.col1<t2.col2
BELONG
--------------------------------------------------------------------------------
A belongs to C
B belongs to D不用case when。。