alter table opl_bkg add  bCode varchar(50)  default null after uid;
update opl_bkg b inner join opl_user u using(uid) set b.bCode=u.buildingcode;
CREATE TABLE opl_bldgUser (uid int(10) unsigned DEFAULT '0',bCode varchar(50) NOT NULL DEFAULT '', UNIQUE KEY u_bldg (uid,bCode)) ENGINE=MyISAM DEFAULT CHARSET=utf8;
insert into opl_bldgUser(uid,bCode) select uid,buildingcode from opl_user where buildingcode<>'';
