哪位大侠在线,求教一个查询,紧急!
我有31个表格,格式相同,第一列为ID,想从中选出在31个表格都出现的ID,并生成31个新表。ID在同一个表中有可能重复,选一个即可。
------解决方案----------------------try
select ID from
(
select distinct ID from T1
union all
select distinct ID from T2
union all
...
union all
select distinct ID from T31
)tmp group by ID having count(*)=31
------解决方案--------------------一样把列添加进去就行,把列名用as转成一样的