【MySql】Column count doesn't match value count at row 1 解决方法

来源:互联网 发布:web编程工具 编辑:程序博客网 时间:2024/06/10 02:21


Column count doesn't match value count at row 1
解决方法

这是因为sql语句多插入了一个值,和表里并不匹配造成的


    set @execSql = concat('insert into REP_CLICK_COUNT(data_time,release_count,forum_count,h5_count,add_count,admin_forum_count,insert_time)',                   ' values(\'1\',\'',dataTime,'\',\'',@releaseCount,'\',\'',@forumCount,'\',\'',@h5Count,'\',\'',@addCount,'\',\'',@adminforumCount,'\',now())');    #SELECT @execSql;        prepare stmt from @execSql;    execute stmt;

如上:

          很明显插入语句多了一个    \'1\ '   的值并没有对应的字段。所以改成


    set @execSql = concat('insert into REP_CLICK_COUNT(<span style="color:#FF0000;">data_type</span>,data_time,release_count,forum_count,h5_count,add_count,admin_forum_count,insert_time)',                   ' values(\'1\',\'',dataTime,'\',\'',@releaseCount,'\',\'',@forumCount,'\',\'',@h5Count,'\',\'',@addCount,'\',\'',@adminforumCount,'\',now())');    #SELECT @execSql; prepare stmt from @execSql;    execute stmt;


问题解决!


0 0
原创粉丝点击