SQL语句实现,两个表的两个不同字段名的合并,请看详细提问

2025-01-07 03:04:30
推荐回答(3个)
回答1:

select id,'A' as type from tableA
union all
select id,'B' as type from tableB

回答2:

create view ab
as
select id,'A' type from a
union all
select id,'B' type from b

回答3:

select id,type='A' from tableA
union all
select id,type='B' from tableB