mysql - Why am I getting " Duplicate entry" errors when inserting the DISTINCT values into a table? -


I am trying to insert specific values ​​of a field from the table request only In the field of the table, pastmonth

  create tab 'pastemoth' (`video_id`) four (5) default faucet, primary key (` video_id`)); Enter Last Month (Video_ID) Select from the difference (video_id) requests from where exec_datetime & gt; = Now () - 60 * 24 * 60 * 60;   

However I get this error

  error code: 1062. Duplicate entry of 'ABCDE' for key 'primary'   

I do not believe that the table request has duplicate entries for the value abcde , because the following query indicates that it has only 1 entry but thereby It does not matter if there was because I am choosing different values.

  SELECT COUNT (*) requests from WHERE video_id = 'abcde'; COUNT (*) 1   

I have a non-unique index on requests.video_id but I think I have an irrelevant to the problem. Is it possible that I have a corrupt BTRE index?

EDIT

  create table 'request' (`request_id` bigint (20) not NULL AUTO_INCREMENT,` video_id` four (5) characters Set Latin 1 Collet Latin 1_ban default tap, `exec_datetime` datetime default tap, primary key (` request_id`), key 'exec_datetime` (`exec_datetime`), engine) 
  

In the requests table, enter the video_id fields Type is defined:

  `video_id` four (5) character set latin1 COLLATE latin1_bin DEFAULT NUL L,   

but in the new table, it is defined:

  `video_id` char (5)   < P> There can be a difference in character set and corresponding matching. Make sure the same letter is set and matched in both fields.   

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -