insert into c (fd1,fd2,fd3) select a.fd1,a.fd2,b.fd3 from a,b where 这两行是标准select语句。。
谢谢回复! 现在是这样,我可以将我需要的数据读到一个临时表中,可要写到一个物理表中却不成功,鉴于表对表操作应该是效率最高的,打算通过一条select语句来解决,请不胜赐教!!!select A.*,B.addr from table1 A,outer table2 B where A.name = "csdn" and A.topic = B.topic order by A.seq into temp tmp_table ;
可以这么做: create Ctab as select a.*,b.* from Atab(A表),btab(B表) where a.name = 条件 and b.name = 条件 这样建立一个临时表C,然后给表改名
------------- select A.*,B.addr from table1 A,outer table2 B where A.name = "csdn" and A.topic = B.topic order by A.seq into temp tmp_table ; ---------------------- 能输出到临时表,也应该能够输出到物理表;除非物理表中的字段类型不匹配
select into 语句写到物理表当然不成功,我估计你说的物理表是指的已存在的表,而临时表是不存在的表,select into 是会创建一个指定名称的表的。 如果是已存在的物理表,建议还是使用insert t1(f1,f2) select * from t2格式。
SQL 有人回答了
select a.fd1,a.fd2,b.fd3 from a,b where 这两行是标准select语句。。
现在是这样,我可以将我需要的数据读到一个临时表中,可要写到一个物理表中却不成功,鉴于表对表操作应该是效率最高的,打算通过一条select语句来解决,请不胜赐教!!!select A.*,B.addr from table1 A,outer table2 B
where A.name = "csdn"
and A.topic = B.topic
order by A.seq
into temp tmp_table ;
create Ctab
as
select a.*,b.* from Atab(A表),btab(B表)
where a.name = 条件
and b.name = 条件
这样建立一个临时表C,然后给表改名
select A.*,B.addr from table1 A,outer table2 B
where A.name = "csdn"
and A.topic = B.topic
order by A.seq
into temp tmp_table ;
----------------------
能输出到临时表,也应该能够输出到物理表;除非物理表中的字段类型不匹配
如果是已存在的物理表,建议还是使用insert t1(f1,f2) select * from t2格式。
select A.*,B.addr from table1 A,outer table2 B
where A.name = "csdn"
and A.topic = B.topic
order by A.seq ;