Question

I have checked alot of posts but still cannot find the answer to an error in one of my tables on my database. When i run a query in SQL i get the following:

Error
SQL query:

0 SQL = INSERT INTO yurzk_user_usergroup_map( user_id, group_id ) 
VALUES ( 140 ) , ( 8 )

MySQL said: Documentation

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0 SQL=INSERT INTO yurzk_user_usergroup_map (user_id,group_id) VALUES (140),(8)' at line 1
Was it helpful?

Solution

if user_id is an autoincrement field and 140 and 8 are two different group_id:

insert into urzk_user_usergroup_map( `user_id`, `group_id` ) VALUES (NULL, '140'), (NULL, '8')

or if 140is the user_id and 8 the group_id

insert into urzk_user_usergroup_map( `user_id`, `group_id` ) VALUES ('140', '8')

OTHER TIPS

the Values part should'nt look like

 VALUES ( 140 ) , ( 8 )

instead it should look like

 VALUES ( 140 , 8 )

INSERT INTO yurzk_user_usergroup_map (user_id,group_id) VALUES (140,8);

This is the correct syntax, check out.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top