DROPTABLEIFEXISTSrelativedetails;CREATETABLEIFNOTEXISTSrelativedetails(idint(10)unsignedzerofillNOTNULLauto_increment,relativeidint(10)unsignedzerofillNOTNULLdefault'0',p...
DROP TABLE IF EXISTS relativedetails;
CREATE TABLE IF NOT EXISTS relativedetails (
id int(10) unsigned zerofill NOT NULL auto_increment,
relativeid int(10) unsigned zerofill NOT NULL default '0',
primaryrelativegroup int(10) unsigned zerofill NOT NULL default '0',
foreignrelativegroup int(10) unsigned zerofill NOT NULL default '0',
primaryuserdetails varchar(255) NOT NULL default '0',
foreignuserdetails varchar(255) NOT NULL default '0',
access TINYINT UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (id),
KEY primaryrelativegroup(primaryrelativegroup),
KEY foreignrelativegroup(foreignrelativegroup),
KEY faccess(access),
foreign key(relativid) references relative(id) on delete cascade on update cascade,
foreign key(primaryrelativegroup) references relativegroup(id)on delete cascade on update cascade,
foreign key(foreignrelativegroup) references relativegroup(id)on delete cascade on update cascade
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
#1072 - Key column 'relativid' doesn't exist in table
展开