Solved

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

Posted on 2014-01-25
2
1,857 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 34

Accepted Solution

by:
Dan Craciun earned 500 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction In this installment of my SQL tidbits, I will be looking at parsing Extensible Markup Language (XML) directly passed as string parameters to MySQL 5.1.5 or higher. These would be instances where LOAD_FILE (http://dev.mysql.com/doc/refm…
Foreword This article was written many years ago, in the days when PHP supported the MySQL extension (http://php.net/manual/en/function.mysql-connect.php).  Today (http://php.net/manual/en/migration70.removed-exts-sapis.php) you would not use MySQL…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

828 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