mysql - SQL Duplicate entry for key 1 -


i've had take on management of database (within school) records stats, @ start of each year these stats supposed reset.

i've been given piece of code run reset these stats, throwing out 'duplicate entry '10172-0' key 1 error when try run it. (the '10172-0' part happens on various other numbers/student_id's). code i've been given is:

insert cfc.student_stats (students_id, no_cfcs) select student_id, 0 roombookings.students student_id >= 1 , student_id <= 15635 

i've checked , there aren't duplicate entries when check out various student_id's i'm @ loss do. underneath error message button 'browse' tells me following:

error  sql query: documentation  select * concat_ws( "-", students_id, no_cfcs ) = "10172-0" order students_id, no_cfcs  mysql said: documentation #1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near 'where concat_ws("-", students_id,  no_cfcs)                     = "10172-0"' @ line 3  

i've had browse through lots of other similar problems on here none of them seemed match getting (but don't understand sql). appreciated, cheers!

you doing this

select * 

in above query missed add table name.

edit

select *    roombookings.students 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -