Problem to query

Hi,
what is the reason to this problem below?

11:06:50      insert into package (in_time,in_by,mod_time,mod_by,deleted,del_time,del_by,status,store,waybill_num,price,remote_charge,total_price,phone,remark,stockout_time,sign_time,sign_store,seven_sign_time,seven_sign_store,return_time,eng_sms,sms_time,bar_time,sms_out_time1,sms_out_time2,store_dscr,is_isg) values(642960,str_to_date('2015-04-01 09:47:09','%Y-%m-%d %h:%i:%s'),155744,str_to_date('2015-04-06 02:24:22','%Y-%m-%d %h:%i:%s'),'system',0,'','','stockout','BHKJ07','000000001300',0,0,0,'60127462','',str_to_date('2015-04-01 09:47:35','%Y-%m-%d %h:%i:%s'),str_to_date('2015-04-04 10:08:00','%Y-%m-%d %h:%i:%s'),'',str_to_date('2015-04-01 23:49:25','%Y-%m-%d %h:%i:%s'),'0336','',0,str_to_date('2015-04-01 09:47:35','%Y-%m-%d %h:%i:%s'),'',str_to_date('2015-04-01 18:55:28','%Y-%m-%d %h:%i:%s'),'','852J1007',0)      Error Code: 1136. Column count doesn't match value count at row 1      0.062 sec
LVL 12
HuaMin ChenProblem resolverAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
>>Error Code: 1136. Column count doesn't match value count at row 1

it means number of columns is not equal to the number of values specified. Either you put in more columns or you put in more values in your insert SQL statement.

in your case:

insert into package (in_time,in_by,mod_time,mod_by,deleted,del_time,del_by,status,store,waybill_num,price,remote_charge,total_price,phone,remark,stockout_time,sign_time,sign_store,seven_sign_time,seven_sign_store,return_time,eng_sms,sms_time,bar_time,sms_out_time1,sms_out_time2,store_dscr,is_isg) values(642960,str_to_date('2015-04-01 09:47:09','%Y-%m-%d %h:%i:%s'),155744,str_to_date('2015-04-06 02:24:22','%Y-%m-%d %h:%i:%s'),'system',0,'','','stockout','BHKJ07','000000001300',0,0,0,'60127462','',str_to_date('2015-04-01 09:47:35','%Y-%m-%d %h:%i:%s'),str_to_date('2015-04-04 10:08:00','%Y-%m-%d %h:%i:%s'),'',str_to_date('2015-04-01 23:49:25','%Y-%m-%d %h:%i:%s'),'0336','',0,str_to_date('2015-04-01 09:47:35','%Y-%m-%d %h:%i:%s'),'',str_to_date('2015-04-01 18:55:28','%Y-%m-%d %h:%i:%s'),'','852J1007',0)  

number of columns: 28

number of values: 29

Pls check on this.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HuaMin ChenProblem resolverAuthor Commented:
Sorry, I don't know exactly  what the reason is.
Mark BullockQA EngineerCommented:
You either need to add one more column name in the list inside the first set of parentheses
OR
remove one of the items in the values list (second set of parentheses).
SolarWinds® Network Configuration Manager (NCM)

SolarWinds® Network Configuration Manager brings structure and peace of mind to configuration management. Bulk config deployment, automatic backups, change detection, vulnerability assessments, and config change templates reduce the time needed for repetitive tasks.

HuaMin ChenProblem resolverAuthor Commented:
here are the columns' Data type
  `in_time` datetime default NULL,
  `in_by` varchar(45) default NULL,
  `mod_time` datetime default NULL,
  `mod_by` varchar(45) default NULL,
  `deleted` varchar(45) default '0',
  `del_time` datetime default NULL,
  `del_by` varchar(45) default NULL,
  `status` varchar(45) default NULL,
  `store` varchar(45) default NULL,
  `waybill_num` varchar(45) default NULL,
  `price` varchar(45) default NULL,
  `remote_charge` varchar(45) default NULL,
  `total_price` varchar(45) default NULL,
  `phone` varchar(45) default NULL,
  `remark` varchar(500) default NULL,
  `stockout_time` datetime default NULL,
  `sign_time` datetime default NULL,
  `sign_store` varchar(45) default NULL,
  `seven_sign_time` datetime default NULL,
  `seven_sign_store` varchar(45) default NULL,
  `return_time` datetime default NULL,
  `eng_sms` varchar(1) default '0',
  `sms_time` datetime default NULL,
  `bar_time` varchar(45) default NULL,
  `sms_out_time1` datetime default NULL,
  `sms_out_time2` datetime default NULL,
  `store_dscr` varchar(45) default NULL,
  `is_isg` int(11) default '0',

Open in new window

HuaMin ChenProblem resolverAuthor Commented:
which is the item to remove?
Mark BullockQA EngineerCommented:
The order of the values in "values" has to match the order of the columns in the first set of parentheses.
For example in_time is a date field, but the first value is an integer. Correct this.
in_by is a character field, but the second value is a date. Correct this.
Keep doing this for every column.
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
@HuaMinChen

not too sure why you always rewarding the experts with a B or even C. You should reconsider to give a fair grade for the experts. if not the experts may feel that you not appreciate their helps and in fact you may no need their helps.

How do I accept a comment as my solution?
http://support.experts-exchange.com/customer/portal/articles/608621-how-do-i-accept-a-comment-as-my-solution-
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Databases

From novice to tech pro — start learning today.