c*d
8 楼
I am using subquery, which is the same as "create new table"
but it is not the answer he expected
【在 a*******t 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: can new table be used?
: not sure if it is the shortest/cleanest, but it's simple
: select *
: into tmpTableC
: from tableA
: update tmpTableC
: set tmpTableC.column1 = tmpTableC.column1 + tableB.column1
: select *
: from tmpTableC
but it is not the answer he expected
【在 a*******t 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: can new table be used?
: not sure if it is the shortest/cleanest, but it's simple
: select *
: into tmpTableC
: from tableA
: update tmpTableC
: set tmpTableC.column1 = tmpTableC.column1 + tableB.column1
: select *
: from tmpTableC
w*r
10 楼
首先你这个提法是有问题的, Table应该看成是无序的set, 你要说有序就要根据某一个
/数个attribute排序
你说的表的行数一样,然后求A+B那么就要假定是有序的
如果是有序的话,那么好办用OLAP做一个sequence出来就完了
下面的SQL是Teradata的,其他的平台有相似的OLAP
select a.CA + b.CA
from
(Select a.* , row_number() over (partition by .. order by ..) as seq from A)
a
(select b.*, row_number() over(partition by .. order by ..) as seq from b) b
where a.seq = b.seq
【在 c*****d 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: 有两个表,相同的结构,相同的行数
: 比如
: A:
: 1
: 0
: 1
: B:
: 0
: 1
: 1
/数个attribute排序
你说的表的行数一样,然后求A+B那么就要假定是有序的
如果是有序的话,那么好办用OLAP做一个sequence出来就完了
下面的SQL是Teradata的,其他的平台有相似的OLAP
select a.CA + b.CA
from
(Select a.* , row_number() over (partition by .. order by ..) as seq from A)
a
(select b.*, row_number() over(partition by .. order by ..) as seq from b) b
where a.seq = b.seq
【在 c*****d 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: 有两个表,相同的结构,相同的行数
: 比如
: A:
: 1
: 0
: 1
: B:
: 0
: 1
: 1
相关阅读
请教如何用alter table 来加一个not null的列How to read CLOB by sqlplus?[转载] Re: 还有人用Windows 3.1吗?pb8怎么连接oracle8.1.7?Re: How to connect to Access 2000 database with database password in ODBChow's job market for Oracle oca/ocp?Help! Splus Code. Thank you.SQL Server 2000: 计算时间差怎样精确到小时MySQL on MacSelect 怎样同时distinct 和order byhow to remove oracle completelyLooking for DB SW急!请教 multidimensional data 的作图问题ASP可以用Oracle为数据库吗?问个问题(mysql)Oracle CertificateHELP: How to restore SQL server 7 backup file to SQL server 2000?请教一个数据库设计的问题[转载] How is Compaq Prolian ML570?安装好sybase 12.5(sybase站上下的)后怎么没有pub2