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 的大作中提到】
: 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 的大作中提到】
: 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 的大作中提到】
: 有两个表,相同的结构,相同的行数
: 比如
: 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 的大作中提到】
: 有两个表,相同的结构,相同的行数
: 比如
: A:
: 1
: 0
: 1
: B:
: 0
: 1
: 1
相关阅读
how to open .QRY file?Help with Oracle Application ServerMicrosoft SQL Server 2000 Developer Edit[转载] How to check disk size for / directory??MySQL database backup4000oralce 9i 必须装在professional 的windows 版本上?Access Table 最多能存多少record?[转载] intensive I/O and odbc problemsql server 新手问题.在一个database里边,xxx-xx-xxx格式的SSN算作什么数据类型?Oracle DBA Handbook 8i & 9i 区别有多大?Database manager for PostgreSQL?[转载] face images database?请教DB migration sybase->oracle救救我, SQL Server 安装问题问一个简单的QueryData Mining Conference Questions==How to achieve Intersect under Mysql?Re: ?? text file, database, ODBC & Matla