由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - SQL add some columns into a table from another table (转载
相关主题
怎么样实现fuzzy joinTruncation error import csv file to SQL table (转载)
Error of SQL query on IBM netezza SQL database from Aginity (转载)技术问题探讨:数据处理
SQL fast search in a 10 million records table (转载)SQL question
typedef and operator new problem问个SQL的问题
多线程优化求助! (转载)mysql DB - 怎么能很容易地update data? (转载)
error of sql query in MS Access database (转载)漂亮!MongoDB力压DB2
sqlite3 db.close() called before db.serialized() finishesMany-to-Many 关系数据存储
我的DBA在生成ORACLE table的时候需要一个一个column看 (转载)请教大家一个LINQ to SQL 的 query
相关话题的讨论汇总
话题: table话题: jim话题: sql话题: acct话题: columns
进入Programming版参与讨论
1 (共1页)
l******9
发帖数: 579
1
On SQL Server 2008 R2, I need to add some columns into a table from another
table.
e.g.
Table1:
name value id
Jim 288 abf
Table 2:
name acct num rank
Jim 12 29 8
Jim 98 95 7
Jim 20 52 9
What I need:
name value id acct num rank acct num rank acct num rank
Jim 288 abf 12 29 8 98 95 7 20 52 9
The record numbers in table 2 may be variable.
Any help would be appreciate.
d****i
发帖数: 4809
2
I guess you really want to have full join on two tables:
SELECT t1.name, t1.value, t1.id, t2.acct, t2.num, t2.rank FROM Table1 AS t1
FULL JOIN Table2 AS t2 ON t1.name=t2.name

another

【在 l******9 的大作中提到】
: On SQL Server 2008 R2, I need to add some columns into a table from another
: table.
: e.g.
: Table1:
: name value id
: Jim 288 abf
: Table 2:
: name acct num rank
: Jim 12 29 8
: Jim 98 95 7

n*w
发帖数: 3393
3
what of there are 1000000 rows for Jim in table 2?
use row number to generate sequence number then pivot

another

【在 l******9 的大作中提到】
: On SQL Server 2008 R2, I need to add some columns into a table from another
: table.
: e.g.
: Table1:
: name value id
: Jim 288 abf
: Table 2:
: name acct num rank
: Jim 12 29 8
: Jim 98 95 7

n*****t
发帖数: 22014
4
SP 可以做,不过为什么要这么设计?一定要做为什么不在 app 里?

another

【在 l******9 的大作中提到】
: On SQL Server 2008 R2, I need to add some columns into a table from another
: table.
: e.g.
: Table1:
: name value id
: Jim 288 abf
: Table 2:
: name acct num rank
: Jim 12 29 8
: Jim 98 95 7

1 (共1页)
进入Programming版参与讨论
相关主题
请教大家一个LINQ to SQL 的 query多线程优化求助! (转载)
请问sql语句能不能实现这样的功能error of sql query in MS Access database (转载)
问个小问题sqlite3 db.close() called before db.serialized() finishes
A question about page table我的DBA在生成ORACLE table的时候需要一个一个column看 (转载)
怎么样实现fuzzy joinTruncation error import csv file to SQL table (转载)
Error of SQL query on IBM netezza SQL database from Aginity (转载)技术问题探讨:数据处理
SQL fast search in a 10 million records table (转载)SQL question
typedef and operator new problem问个SQL的问题
相关话题的讨论汇总
话题: table话题: jim话题: sql话题: acct话题: columns