树型结构|数据|显示|语句
SELECT dpcode1 as dpcode,dpname1 as dpname
FROM BASE_CUSTDEPT where dpcode1>0 and dpcode2=0 and dpcode3=0 and dpcode4=0
union all
SELECT dpcode1+dpcode2 as dpcode,dpname1+dpname2 as dpname
FROM BASE_CUSTDEPT where dpcode1>0 and dpcode2>0 and dpcode3=0 and dpcode4=0
union all
SELECT dpcode1+dpcode2 +dpcode3 as dpcode,dpname1+dpname2+dpname3 as dpname
FROM BASE_CUSTDEPT where dpcode1>0 and dpcode2>0 and dpcode3>0 and dpcode4=0
union all
SELECT dpcode1+dpcode2 +dpcode3+dpcode4 as dpcode,dpname1+dpname2+dpname3+dpname4 as dpname
FROM BASE_CUSTDEPT where dpcode1>0 and dpcode2>0 and dpcode3>0 and dpcode4>0
时间: 2024-11-01 06:41:40