+ -
当前位置:首页 → 问答吧 → oracle 合并两张不同结构的表数据?

oracle 合并两张不同结构的表数据?

时间:2011-12-01

来源:互联网

select *From t_ecp_data t where t.enble='Y'
union all
select *from t_entity_path_index

t_ecp_data 

t_entity_path_index表结构不一样

作者: xwgemail   发布时间: 2011-12-01

表结构不一样的话,不能用这种union all的语句。
你想把两张表的数据都列出来?还是想干嘛?

作者: yixilan   发布时间: 2011-12-01

引用楼主 xwgemail 的回复:
select *From t_ecp_data t where t.enble='Y'
union all
select *from t_entity_path_index

t_ecp_data

t_entity_path_index表结构不一样


结构不一样,需要指明结果中的列,两个表的结果列相同即可,如:
select A,B,C From t_ecp_data t where t.enble='Y'
union all
select A,B,C from t_entity_path_index

作者: xiaobn_cn   发布时间: 2011-12-01