我必须将一个坏代码转换为一个更好的解决方案,从我们的网站计算计数。我有一个表,用来计算
出现的次数当前表:
CREATE TABLE `hits_2011_12_5` (
`count` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
现在我想慢慢地将新代码迁移到旧代码,但是我有这个错误与新代码:
ana@localhost:test> insert into hits_2011_12_5 values (1,2,3,4,5);
ERROR 1136 (21S01): Column count doesn't match value count at row 1
有什么问题吗?
use this:
ana@localhost:test> insert into hits_2011_12_5 values (1),(2),(3),(4),(5);
Query OK, 5 rows affected (0.00 sec)
Records: 5 Duplicates: 0 Warnings: 0
您尝试的查询需要5列,而不是插入5行。