方案一,建议A表中的1,X,L,K,2,E,O,P,3,4,R...  在生成时改写成1,X,L,K;2,E,O,P;3;4,R...
即数字前用其他符号 ,这样就就可以用cs的split或 sql的语句(字符分割),再下面就可以继续处理了!
方案二,
可以建个临时表
declare @temp table(bmid int identity(1,1) not null,bm varchar(20), int bmbz,int lx)
然后用sql的 CHARINDEX  和 substring 分解字符串 ,然后 
insert into @temp(bm) values(@bm) 插入临时表中
然后写
update @temp set bmbz=bmid where bm in (select bh from B)然后写游标循环(order by id),取变量@bmid,@bmbz
判断当前行 的 @bmbz 是否为空,不空则
select @oldbmbz= @bmbz 
update @temp set lx=0 where bmid=@bmid 
,如果@bmbz为空,则 
update @temp set bmbz=@oldbmbz,lx=1 where bmid=@bmid 最后
select t1.bm,b.mc,t2.bm,c.dz @temp as t1 
left join @temp as t2 on t1.bmbz=t2.bmbz
join b on b.bh=t1.bm
join c on c.bh=t2.bm
where t1.lx=0 and t2.lx=1最终结果应该是张三                电影院
张三                    工厂
张三                    地铁
李四                   学校
李四                    商场
李四                    剧场
王五
等等                    饭店http://www.mybuffet.cn