1
INSERT INTO master_table (`Group_No`, `Group_Name`,`Order_No`) VALUES (6,'Purchase Account','SELECT Order_no FROM acc_group_master where Group_No=1')

How can i insert data into Order_No column.

4 Answers 4

1

You can try this

INSERT INTO master_table (`Group_No`, `Group_Name`,`Order_No`)
SELECT 6,'Purchase Account',Order_no FROM acc_group_master where Group_No=1
Sign up to request clarification or add additional context in comments.

Comments

0
INSERT INTO master_table (`Group_No`, `Group_Name`,`Order_No`) VALUES
(SELECT 6, 'purchase Account', Order_no FROM acc_group_master where Group_No=1)

Comments

0

try this

INSERT INTO master_table (`Group_No`, `Group_Name`,`Order_No`) VALUES 
(6,'Purchase Account',(SELECT Order_no FROM acc_group_master where Group_No=1))

Comments

0

You have surrounded your subquery with quotes '..' wich make it becomes a string and been inserted as it is in your database, simply remove quotes and apply brackets instead

INSERT INTO master_table (`Group_No`, `Group_Name`,`Order_No`) 
VALUES (6,'Purchase Account',(SELECT Order_no FROM acc_group_master where Group_No=1))

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.