日期:2013-04-30  浏览次数:20638 次

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