mysql - Connecting fields in tables when the tables are already connected through other field -
mysql - Connecting fields in tables when the tables are already connected through other field -
i have 2 tables:
create table `osoby_dane` ( `os_id` int(6) not null auto_increment primary key, `imie` text, `status` int(1) ) engine=innodb default charset=utf8; create table `osoby_rank` ( `os_id` int(6) not null primary key, `os_rank` int default 1000, `status` int(1), constraint `fk_rank` foreign key (os_id) references osoby_dane(os_id) on update cascade on delete restrict ) engine=innodb default charset=utf8;
example: osoby_dane:
os_id | imie | status | 1 |john |1 |osoby_rank:
os_id | os_rank | status | 1 | 1400 | 1 |my question how can (if can @ all..) connect fields in same rows (status column) 1 1 (if edit status field in 1 table in sec changed automatically). , don't want utilize trigger function
make in osoby_rank constraint
, in osoby_dane create fk_status
foreign key (os_id, status) references osoby_dane(os_id, status) on update cascadekey status_idx(os_id, status)
should working
mysql
Comments
Post a Comment