?
Solved

Error Code: 1136. Column count doesn't match value count at row 1

Posted on 2014-01-25
2
Medium Priority
?
2,247 Views
Last Modified: 2014-01-25
CREATE TABLE `a_messages2` (
  `a_messages_id` int(11) NOT NULL auto_increment,
  `conversation_id` bigint(20) default NULL,
  `profile_id` varchar(20) default NULL,
  `sender` varchar(20) default NULL,
  `message_id` bigint(20) default NULL,
  `message_text` varchar(1000) default NULL,
  `dateAgo` varchar(20) default NULL,
  `message_read` tinyint(4) default NULL,
  `this_user` varchar(20) default NULL,
  PRIMARY KEY  (`a_messages_id`),
  UNIQUE KEY `unique_message_id` (`message_id`)
)




CREATE TABLE `a_messages3` (
       `a_messages_id` INT (11) auto_increment
     , `profile_id` VARCHAR(20)
     , `sender` VARCHAR(20)
     , `message_id` BIGINT (20)
     , `this_user` VARCHAR(20)
     , PRIMARY KEY (a_messages_id)
     , INDEX profile_id (profile_id)
     , INDEX profile_id_and_message_id (profile_id,message_id)
     );


insert into a_messages3 select profile_id,sender,message_id,this_user from a_messages2

Error Code: 1136. Column count doesn't match value count at row 1
0
Comment
Question by:rgb192
2 Comments
 
LVL 35

Accepted Solution

by:
Dan Craciun earned 2000 total points
ID: 39809314
Try
INSERT INTO a_messages3 (profile_id,sender,message_id,this_user) 
  SELECT profile_id,sender,message_id,this_user FROM a_messages2

Open in new window


If you do not specify the fields, MySQL will expect 5 fields and the second select only provides 4.

HTH,
Dan
0
 

Author Closing Comment

by:rgb192
ID: 39809575
INSERT INTO a_messages3 (profile_id,sender,message_id,this_user)
  SELECT profile_id,sender,message_id,this_user FROM a_messages2

works because of insert

thanks
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month15 days, 10 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question