Mysql conditional insert(With the combined primary key) -
i have table following structure
id -- auto increment name -- unique group -- integer primary key(name,group)
i not want add element same name , group values.
(i.e ("test",1) , ("test",1) should not inserted.... , ("test",1),("test",2) can inserted).
i want insert value if not exist .. checked link.
using above link possible operation , problem checks name key not combined group (i.e insertion of values("test",1) , ("test",2) not happening)
how can this.
i think problem name column unique ,please remove unique constraint on name column , try insert ignore yourtable(name,group)values("test",2)
Comments
Post a Comment