Jseven_jy的方法, UNION 的地方, 变为 UNION ALL 就可以了。 也就是: (select 字段1, 字段4 from 源表 ) union all (select 字段2 as 字段1, 字段4 from 源表) union all (select 字段3 as 字段1, 字段4 from 源表)
(select 字段1, 字段4 from 源表)union (select 字段2 as 字段1, 字段4 from 源表)union (select 字段3 as 字段1, 字段4 from 源表)
我这边测试是对的啊。。。你再试试呢。。。
希望对你有帮助。。。。。
第2个回答 2011-01-25
select case when t2.f1 = 1 then t1.f1 when t2.f1 = 2 then t1.f2 when t2.f1 = 3 then t1.f3 end f1, f4 from 原表 t1, (select 1 f1 from dual union all select 2 f1 from dual union all select 3 f1 from dual) t2