我想在一个字段中将多个值插入MySQL,其余字段只包含一个值。
我试过下面的查询
INSERT INTO assessment_training(
PARENT_SLNO
RNO
TRAINING_CATEGORY
TRAINING_NAME
)
VALUES (
9,
1,
'Technical',
(1,7)
);
错误#1241
`INSERT INTO assessment_training(PARENT_SLNO,RNO,TRAINING_CATEGORY,TRAINING_NAME) VALUES (9,1,'Technical',(1,7)) Error Code: 1241. Operand should contain 1 column(s)`
答案 0 :(得分:0)
您可以使用CONCAT()
INSERT INTO assessment_training(
PARENT_SLNO,
RNO,
TRAINING_CATEGORY,
TRAINING_NAME
)
VALUES (
9,
1,
'Technical',
CONCAT("1", ",", "7")
);