There is a table:
CREATE TABLE `test` ( `id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, `id_kvitanc` VARCHAR(100) NOT NULL `id_magazin` VARCHAR(100) NOT NULL ) ENGINE = MYISAM So the essence is as follows: id is a unique entry, id_magazin , id_magazin is the store ID from another table, numbers (1,2,3) id_kvitanc is the number of the check that created the store. Is it possible to make it so that if id_kvitanc=1 (for example, the first store), then it would be impossible to add an entry with id_kvitanc=500 , if id_kvitanc=500 already exists? (but for id_magazin=2 , maybe id_kvitanc=500 ) more precisely, so that id_kvitanc filled in uniquely auto-incrementally?
UNIQUE(id_magazin, id_kvitanc). Autoincrement onid_kvitanc, as on theidfield you can’t do it, you will have to emulate it yourself in the code .. - Arnialint, something from this then it turns out? differs in that id is a unique entry in the table, and id_kvitanc can be the same value, but with different id_magazin, for example: id = 1, id_kvitanc = 500, id_magazin = 3 and id = 2, id_kvitanc = 500, id_magazin = 4 - Samoylenko Alexandr