Issue is I need to have a unique value in a column based on value from another column.
for ex : I have item_ID and product column
For every item_ID there should only be unique values in the product column.
item_ID Product
1 1
1 2
1 4
2 1
but if I insert 1 in item_ID and 1 in product now, it should throw an error. I have no idea how to implement this. Any help appreciated.
What you need is a unique index for both columns
alter table yourtable add unique index(item_ID, Product);
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments