比如说 表A,B中都有 name字段,而且两张表没关系,查询 select name from a,select name from b
将查询出来的结果显示在一张表里的一个字段里面……谢谢各位大虾了……
union 做连接就可以了。
用union
create table table_1 ( id int identity(1,1), name varchar(80) ) create table table_2 ( indexs int identity(1,1), Tname varchar(80) ) insert into table_1(name) values('li') insert into table_1(name) values('zhang') insert into table_1(name) values('wang') insert into table_1(name) values('zhao') insert into table_2(Tname) values('yuan') insert into table_2(Tname) values('fei') insert into table_2(Tname) values('yun') select name from table_1 union select Tname from table_2
结果
name -------------------------------------------------------------------------------- fei li wang yuan yun zhang zhao