Solved

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

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This guide whil teach how to setup live replication (database mirroring) on 2 servers for backup or other purposes. In our example situation we have this network schema (see atachment). We need to replicate EVERY executed SQL query on server 1 to…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now