我知道SQL SERVER里有个TABLE类型, 好象你用INSERT语句把要查找的记录插入到表C中 具体的我也不清楚了,好象和操作实在的表没什么区别你不用C表多好啊,你完全可以这样的:(不知道行不) SELECT A.a,B.b From A,B Where <条件>
lxf31(@穷鬼透明人@) :SELECT A.a,B.b From A,B Where <条件>
上面就可以了
select a,b,c from (select a from tablea),(select b as b from tableb),(select c from tablec)
select A.a,B.b from A,B where 条件............. 如果 A、B两表没有关联,那这样就没有什么意思.......................
没有关联查询出来会是什么样子呀,没意思的,如有关联 可以这样 SELECT A.a,B.b from A a,B,b where 条件
insert into c(a,b) SELECT A.a,B.b From A,B Where <条件>
我对这类问题作过研究,目前还没发现更好的办法 现在只能说 这种一步是办不到的,要分几步1.假设a,b都是numeric型的 2.select a, 0 as b into #a from ta 3.select 0 as a, b into #b from tb4.create table #t(a,b)5.insert into #t select * from #a union all select * from #b 6.insert c(a,b) select sum(a), sum(b) from #t group by 条件 7.drop table #t 8.ok.
好象你用INSERT语句把要查找的记录插入到表C中
具体的我也不清楚了,好象和操作实在的表没什么区别你不用C表多好啊,你完全可以这样的:(不知道行不)
SELECT A.a,B.b
From A,B
Where <条件>
From A,B
Where <条件>
上面就可以了
(select a from tablea),(select b as b from tableb),(select c from tablec)
from A,B
where 条件.............
如果 A、B两表没有关联,那这样就没有什么意思.......................
可以这样
SELECT A.a,B.b from A a,B,b
where 条件
SELECT A.a,B.b
From A,B
Where <条件>
现在只能说 这种一步是办不到的,要分几步1.假设a,b都是numeric型的
2.select a, 0 as b into #a from ta
3.select 0 as a, b into #b from tb4.create table #t(a,b)5.insert into #t
select * from #a
union all
select * from #b
6.insert c(a,b)
select sum(a), sum(b) from #t group by 条件
7.drop table #t
8.ok.
select A.a, B.b, C.*
from A, B, C