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

python - how we can use ajax() in views.py in django? -

matlab - Using loops to get multiple values into a cell -

python - Sequence Pattern recognition with Pybrain -