怎样用SQL语句合并两个表中的两个列

2025-02-13 09:50:21
推荐回答(4个)
回答1:

你给个条件好让两条合并成一条啊。如
select a.names, b.names as typ from table1 as a ,table2 as b where a.id=b.id

回答2:

select * from (
select names from table1

union all
select names from table2
)a

这样就是得到2个表的数据在同一列出现

回答3:

建议直接用union all程序:

select names as typ

from table1

union all

select names

from table2

回答4:

不知道你具体什么数据库,且表述不清楚,大概写下,,,
sqlserver可以

select (a.names+ b.names) as typ
from table1 as a ,table2 as b

where a.关联字段=b.关联字段