T1,T2,T3 表里面的数据如下
T1 aa 1 2 3
T2 aa 11 22 33
T3 aa 111 222 333
我想结果是:
aa 1 2 3 11 22 33 111 222 333
T1 aa 1 2 3
T2 aa 11 22 33
T3 aa 111 222 333
我想结果是:
aa 1 2 3 11 22 33 111 222 333
解决方案 »
- sql 日期数据集查询
- 这个问题弄了几个晚上都没结果,要被炒了 高手呀 救命呀 我等着你
- 装好SQL2000后,是否就可以给网络用户使用??
- 存储过程中如何在执行一条SQL语句后得到它的值?
- ConnectionWrite (send()).]一般性网络错误怎么解决
- otl 怎样取存储过程(多个)结果集 ?
- 创建规则时提示语法错误
- asp调用存储过程时出的错误,谁能帮我解决一下啊?
- 求进销存软件,能通过调制解器进行远程存储,请mail: [email protected]
- 求一条SQL语句,按日期统计,没有数据显示为0
- ntext 转化为nvarchar 类型?
- SQLSERVER 中 ,怎么处理异常?
declare @t2 table(code varchar(4),c4 int,c5 int,c6 int)
declare @t3 table(code varchar(4),c7 int,c8 int,c9 int)
select a.*,b.c4,b.c5,b.c6,c.c7,c.c8,c.c9
from @t1 a,@t2 b,@t3 c
where a.code=b.code and a.code=c.code
declare @t2 table(code varchar(4),c4 int,c5 int,c6 int)
declare @t3 table(code varchar(4),c7 int,c8 int,c9 int)
insert into @t1 select 'aa', 1, 2, 3
insert into @t2 select 'aa', 11, 22, 33
insert into @t3 select 'aa',111,222,333select
a.*,b.c4,b.c5,b.c6,c.c7,c.c8,c.c9
from
@t1 a,@t2 b,@t3 c
where
a.code=b.code and a.code=c.code/*
code c1 c2 c3 c4 c5 c6 c7 c8 c9
---- ----------- ----------- ----------- ----------- ----------- ----------- ----------- ----------- -----------
aa 1 2 3 11 22 33 111 222 333
*/
declare @t1 table(code varchar(4),c1 int,c2 int,c3 int)
declare @t2 table(code varchar(4),c4 int,c5 int,c6 int)
declare @t3 table(code varchar(4),c7 int,c8 int,c9 int)
insert into @t1 select 'aa', 1, 2, 3
insert into @t2 select 'aa', 11, 22, 33
insert into @t3 select 'aa',111,222,333select a.*,b.c4,b.c5,b.c6,c.c7,c.c8,c.c9
from @t1 a
inner join @t2 b on a.code=b.code
inner join @t3 c on a.code=c.code/*
code c1 c2 c3 c4 c5 c6 c7 c8 c9
---- ----------- ----------- ----------- ----------- ----------- ----------- ----------- ----------- -----------
aa 1 2 3 11 22 33 111 222 333
*/
from T1 a join T2 b on a.col1 = b.col1
join T2 c on a.col1 = c.col1
declare @t2 table(code varchar(4),c4 varchar(20),c5 varchar(20),c6 varchar(20))
declare @t3 table(code varchar(4),c7 int,varchar(20),int,c9 varchar(20))
insert into @t1 select 'aa', 1, 2, 3
insert into @t2 select 'aa', 11, 22, 33
insert into @t3 select 'aa',111,222,333select a.*,b.c4,b.c5,b.c6,c.c7,c.c8,c.c9
from @t1 a
inner join @t2 b on a.code=b.code
inner join @t3 c on a.code=c.code