update t_bd_bomversion ver set fversionname = case when (select t2.fentryid from  
(select v.fid ,v.fbomversionrule ,vl.fname from t_bd_bomversion v left join 
t_bd_bomversion_l vl on v.fid =vl.fid  where vl.flocaleid='zh_CN')t1 
left join  
(select re.fid,rel.fversion,re.fentryid from t_bd_bomversionruleentry re  
left join t_bd_bomversionruleentry_l rel on re.fentryid = rel.fentryid  
where rel.flocaleid ='zh_CN') t2 
on t1.fbomversionrule = t2.fid and t1.fname = t2.fversion where t1.fid=ver.fid) is null
then 0
else (select t2.fentryid from  
(select v.fid ,v.fbomversionrule ,vl.fname from t_bd_bomversion v left join 
t_bd_bomversion_l vl on v.fid =vl.fid  where vl.flocaleid='zh_CN')t1 
left join  
(select re.fid,rel.fversion,re.fentryid from t_bd_bomversionruleentry re  
left join t_bd_bomversionruleentry_l rel on re.fentryid = rel.fentryid  
where rel.flocaleid ='zh_CN') t2 
on t1.fbomversionrule = t2.fid and t1.fname = t2.fversion where t1.fid=ver.fid) end;