mysql - unique value based on another column value? -


The issue is that I should have a unique value in the column based on price from the second column.

For pre: I have item_ID and product columns

Only item columns for each item_id should have unique value.

  item_ID Product 1 1 2 1 4 2 1   

But if I include 1 in item_ID and now 1 in the product, then it will be an error Should not throw it I do not know how to implement it. Any help appreciated.

You have a unique index for both columns

  Change your unique index (item_id, product);    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -