私は4つの異なるテーブルを持っています
- アカウント、
- ブランチ、
- tblbillers、
- tblbillerpolicy、
列を含む 4 つのテーブル
- アカウント (accntID)主キー...
- ブランチ (branchID)Primary KEY...
- tblbillers (Billerid) および
- tblbillerpolicy (PolicyID Primary Key, accountID, BranchID, BIllerID, Enabled, ServiceCharge, MerchantCOmission,PLUCode)
ここで、次のようにテーブル tblbillerpolicy を挿入します。
INSERT INTO dbo.tblbillerpolicy
(
AccountID ,
BranchID ,
BillerID ,
Enabled ,
ServiceCharge ,
MerchantComission ,
PLUCode
)
Select 142, 2171, 2, 'YES', 0.00, 3.50, 'NULL'
UNION ALL
Select 143, 2171, 2, 'YES', 0.00, 3.50, 'NULL'
UNION ALL
Select 143, 2171, 2, 'YES', 0.00, 3.50, 'NULL'
UNION ALL
Select 143, 2171, 2, 'YES', 0.00, 3.50, 'NULL'
where AccountID = accntid <-- for account
and BranchID = branchid <-- for branch
and BillerID = billerid <-- for tblbillers
今私が本当にしたいのは、この「ONLY」を、上記のテーブル (アカウント、ブランチ、ビラー) に接続された tblbillerpolicy に挿入することです。