avatar
Urgent help needed, please# Database - 数据库
w*i
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:
avatar
w*i
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

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。