由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - Urgent help needed, please
相关主题
#在SQL里啥子意思Questions on SQL
How to replace 0 with empty?SQL Server stupid questions
问一个SQL Server的问题how to get all numerical data?
SQL问题请教: add one more columnCan I create thousands table in one...
请各位帮我看看这个最简单的Stored Procedure (转载)誰來幫我開來開悄? Interesting SQL query
create table on SQL server from python pyodbc (转载)请教2个sql query 问题
Urgent SQL problem!About INSERT IGNORE
请教三个Key的property,用SSIS传table从oracle到mssql,遇到一个奇怪的问题
相关话题的讨论汇总
话题: null话题: table话题: urgent话题: varchar话题: invid
进入Database版参与讨论
1 (共1页)
w*i
发帖数: 63
1
A job must done before tomorrow, please help...
we have two tables here,
table 1,
CREATE TABLE dbo.eai_inv_hdr
(
invid numeric(9,0) IDENTITY,
vendorid varchar(10) NOT NULL,
invnbr int NOT NULL,
batchid varchar(10) NOT NULL,
status varchar(1) NOT NULL
)
table2,
CREATE TABLE dbo.eai_inv_dtl
(
invamtid numeric(9,0) IDENTITY,
invid numeric(9,0) NOT NULL,
invamtcd varchar(10) NOT NULL,
invamt decimal(13,2) NOT NULL
)
table example:
w*i
发帖数: 63
2
some explaination, the steps is:
scan all vendorid and invnbr in eai_inv_hdr table,
for those are same of v1 and i1, get their invid,
in this case, 1 and 2. then select all rows in
eai_inv_dtl table which invid are 1 and 2. then
sum the same invamcd, and put the invcmcd and
the sumed number into the destination table.
for those not has a value, put amtcd as NULL
and put amount as 0.
thanks for you guys help...

【在 w*i 的大作中提到】
: A job must done before tomorrow, please help...
: we have two tables here,
: table 1,
: CREATE TABLE dbo.eai_inv_hdr
: (
: invid numeric(9,0) IDENTITY,
: vendorid varchar(10) NOT NULL,
: invnbr int NOT NULL,
: batchid varchar(10) NOT NULL,
: status varchar(1) NOT NULL

1 (共1页)
进入Database版参与讨论
相关主题
用SSIS传table从oracle到mssql,遇到一个奇怪的问题请各位帮我看看这个最简单的Stored Procedure (转载)
mysql index优化求助 (转载)create table on SQL server from python pyodbc (转载)
int or varchar?Urgent SQL problem!
誰來解釋一下這是什麼原理请教三个Key的property,
#在SQL里啥子意思Questions on SQL
How to replace 0 with empty?SQL Server stupid questions
问一个SQL Server的问题how to get all numerical data?
SQL问题请教: add one more columnCan I create thousands table in one...
相关话题的讨论汇总
话题: null话题: table话题: urgent话题: varchar话题: invid