树形数据显示SQL示例代码(在ms sql 2000 DBMS中调试通过)

    树形数据显示SQL示例代码(在ms sql 2000 DBMS中调试通过)

SELECT DeptCode1 + DeptCode2 + DeptCode3 AS dpcode,
      CASE WHEN deptname2 = '' THEN deptname1 WHEN deptname2 <> '' AND
      deptname3 = '' THEN DeptName1 + '/' + DeptName2 WHEN deptname2 <> '' AND
      deptname3 <> '' THEN DeptName1 + '/' + DeptName2 + '/' + DeptName3 END AS dpname
FROM dbo.Department

树形数据显示SQL示例代码(在ms sql 2000 DBMS中调试通过)_第1张图片

你可能感兴趣的:(sql)