Select a from x where xxx
Union all
Select b from x where xxx
Union all
Select b from x where xxx
原表和查询条件都一样,使用union all要读两次原表,有什么方法可以改写一下,只做一次读
答:
select decode(l,1,a,b) from
(select a,b from x where xx),
(select level l from dual connect by level<=2)