如果值不为空,我尝试将表中的 3 列合并为一列。这是我的桌子:
CREATE TABLE IF NOT EXISTS `roles_map` (
`rm_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`username_a` varchar(45),
`username_l` varchar(45),
`username_u` varchar(45),
`password` varchar(45) NOT NULL,
`role_id` int(1) NOT NULL,
PRIMARY KEY (`rm_id`),
FOREIGN KEY (username_u) REFERENCES users(index_num),
FOREIGN KEY (username_a) REFERENCES admins(login),
FOREIGN KEY (username_l) REFERENCES lecturers(id_number),
FOREIGN KEY (role_id) REFERENCES roles_name(role_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
我尝试加入 username_l、username_u、username_a,因为只有一个有值!= null。
有人可以帮助我吗?