我尝试在我的查询中使用重复密钥更新上的,但它仍然重复某个值。重复密钥更新不起作用
我的查询是这样的:
$insert=mysqli_query($conn,"insert into tbl_staffdistribution(db_user,db_name,db_responsible,db_date)values('$user','$name','$responsible','$formatteddatetimein') on duplicate key update db_user='$user',db_name='$name',db_responsible='$responsible',db_date='$formatteddatetimein'")or die(mysqli_error($conn));
我有在我的数据库DB_ID是主键自动递增。
问题是我在我的数据库中有一个重复的值,这不应该发生如何解决这个问题?
有您创建特定的列唯一键 –
@AnkitAgrawal我只有DB_ID初级和经销商的增量没有别的 – m7md
等哪一列基础上你是独一无二的区分已经data..you创建一个唯一的列,这样就可以识别data –