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

4 回答 4

1

你可以试试这个

INSERT INTO master_table (`Group_No`, `Group_Name`,`Order_No`)
SELECT 6,'Purchase Account',Order_no FROM acc_group_master where Group_No=1
于 2013-06-04T10:58:43.370 回答
0

您已经用引号包围了您的子查询,'..'使其成为一个字符串并按原样插入到您的数据库中,只需删除引号并应用括号即可

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))
于 2013-06-04T10:58:29.977 回答
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)
于 2013-06-04T10:59:19.220 回答
0

尝试这个

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))
于 2013-06-04T10:59:52.173 回答