sql2000如何查询两张表中相同的列名

2024-12-17 11:20:50
推荐回答(4个)
回答1:

select a.name from
(select * from syscolumns where id=object_id(N'表A') )a
inner join
(
select * from syscolumns where id=object_id(N'表B')
) b
on a.name = b.name

回答2:

select DISTINCT name from syscolumns where
name in (select name from syscolumns where id in
(select id from sysobjects where name in ('A')))
and
name in (select name from syscolumns where id in
(select id from sysobjects where name in ('B')))
order by name

回答3:

带表名即可
select a.c,b.c,a.d,b.d from a,b

回答4:

学习了