这是我的查询,注释行是我要插入的
insert into tbl_StockTransactions(ItemCode,TransactionDate,Narration,Docid,ReferenceNo,Qty,Price,UserId,BranchCode,StaffCode) select ItemCode,getDate(),Description,PostingDocid,'New Ref',Qty,Price,'uid','bc','sc' from tbl_PostingDetailsStock where PostingReference='A000275'
--select ItemCode,getDate(),Description,PostingDocid,'New Ref',Qty,Price,'uid','bc','sc' from tbl_PostingDetailsStock where PostingReference='A000276'; 发布于 2016-11-25 09:00:06
试试下面的代码:
insert into tbl_StockTransactions(
ItemCode, TransactionDate, Narration, Docid, ReferenceNo, Qty,
Price, UserId, BranchCode, StaffCode
)
SELECT ItemCode, getDate(), Description, PostingDocid, 'New Ref', Qty,
Price, 'uid', 'bc', 'sc'
FROM tbl_PostingDetailsStock
WHERE PostingReference IN ('A000275','A000276')发布于 2016-11-25 08:49:34
insert into tbl_StockTransactions(ItemCode,TransactionDate,Narration
,Docid,ReferenceNo,Qty,Price,UserId,BranchCode,StaffCode)
select ItemCode,getDate(),Description,PostingDocid,'New Ref',Qty,Price,'uid','bc','sc' from tbl_PostingDetailsStock
where PostingReference IN ('A000275','A000276')发布于 2016-11-25 09:10:50
select ItemCode,getDate(),Description,PostingDocid,'New Ref',Qty,Price,'uid','bc','sc'
into tbl_StockTransactions
from tbl_PostingDetailsStock
where PostingReference='A000275'https://stackoverflow.com/questions/40800850
复制相似问题