Incorrect integer value: '' for column

2019-07-28 03:39发布

问题:

What wrong in the following query? I want to copy some fields from one table to another.

INSERT INTO `dle_post_plus` 
(
   `news_id`, `news_read`, `allow_rate`, `rating`, 
   `vote_num`, `votes`, `view_edit`, `access`, 
   `editdate`, `editor`, `reason`, `user_id`
) 
SELECT `id`, `news_read`, `allow_rate`, `rating`, 
   `vote_num`, `votes`, `view_edit`, `access`, 
   `editdate`, `editor`, `reason`, `user_id` 
FROM `dle_post` 
LEFT JOIN dle_users 
  ON (dle_post.autor=dle_users.name)

erro:

#1366 - Incorrect integer value: '' for column 'editdate' at row 1

回答1:

Make sure all columns are the same type in both tables.Check editdate.Probably in dle_post_plus the column is INT and in dle_post is varchar.