这是我查询表的创建

CREATE TABLE `result` (
  `id` int(11) NOT NULL,
  `l_id` varchar(25) NOT NULL,
  `lname` varchar(200) NOT NULL,
  `first_prize` varchar(9) DEFAULT NULL,
  `consolation_prize` varchar(9) DEFAULT NULL,
  `second_prize` varchar(9) DEFAULT NULL,
  `third_prize` varchar(9) DEFAULT NULL,
  `fourth_prize` int(11) DEFAULT NULL,
  `fifth_prize` int(11) DEFAULT NULL,
  `sixth_prize` int(11) DEFAULT NULL,
  `seventh_prize` int(11) DEFAULT NULL,
  `eigth_prize` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


这是插入值的查询

INSERT INTO `result` (`id`, `l_id`, `lname`, `first_prize`, `consolation_prize`, `second_prize`, `third_prize`, `fourth_prize`, `fifth_prize`, `sixth_prize`, `seventh_prize`, `eigth_prize`) VALUES
(1, '1', 'Win-Win', 'WO-878475', 'WO-878474', 'WO-878477', 'WO-878455', 8474, 8477, 8412, 8473, 8689),
(2, '2', 'KARUNNYA', NULL, NULL, NULL, NULL, 6, NULL, NULL, NULL, NULL),
(3, '3', 'SOUBHAGYA', 'WE-878656', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(4, '4', 'SREE SAKTHI', 'NB-750180', 'NE-750180', 'KO-594630', 'KF-678534', 6786, 4356, 2456, 4566, 7657);


问题是,我无法将多个值插入到诸如first_prize,second_prize,third_prize等的任何列中...
如何做到这一点,请帮助我,我不知道,我是新手。

最佳答案

插入结果(id,l_id,lname,first_prize,consolation_prize,second_prize,third_prize,fourth_prize,fifth_prize,sixel_prize,seventh_prize,eigth_prize)
值(1,'1','Win-Win','WO-878475,WO-878474,WO-878477',NULL,NULL,'WO-878455',8474,8477,8412,8473,8689);

增加列的长度。

关于php - 如何在mysql中的列中添加多个值,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/49772258/

10-10 18:38