0

This is my query, the commented line is what i want to insert

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'; 

3 Answers 3

3

Try this code:

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')
Sign up to request clarification or add additional context in comments.

2 Comments

Sorry for those who have answered, this what i wanted
@EmmanuelOgoma, if it meets your requirements, click on check mark below just upvote button [flag it as Accepted] of this Answer.. to help in future use
0
select ItemCode,getDate(),Description,PostingDocid,'New Ref',Qty,Price,'uid','bc','sc' 
into tbl_StockTransactions
from tbl_PostingDetailsStock 
where PostingReference='A000275'

Comments

0
 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')

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.