select a.bm 部门,(select s.depart_name from sys_depart s where s.id=a.bm) '申请部门',a.appply_dept
from (
select substring_index(a.appply_dept,',',1) bm,a.* from assets_purchase_apply a where locate(',',a.appply_dept)>0
union all
select substring_index(a.appply_dept,',',-1) bm,a.* from assets_purchase_apply a where locate(',',a.appply_dept)>0
union all
select appply_dept bm,a.* from assets_purchase_apply a where locate(',',a.appply_dept)=0
) a