i have a table like
CREATE TABLE IF NOT EXISTS grouped_executions ( id INTEGER UNSIGNET NOT NULL , execution_id INTEGER UNSIGNED NOT NULL REFERENCES execution.execution_id , president BOOLEAN NOT NULL DEFAULT 0 PRIMARY KEY ( id, execution_id ) ) ENGINE = InnoDB ;
all i want is to make president unique in a group of rows with same id.
for example: i have such data:
id | execution_id | president = - = - = - = - = - = - = - = 1 | 1 | 0 1 | 2 | 1 1 | 3 | 0 1 | 4 | 0i want mysql prevents inserting new row with id = 1 & president = 1
( of course i can make another table that holds president of a group but is above structure possible? )