日期:2014-05-17 浏览次数:20812 次
select userType.userTypeName,menu.parentNode,userType.id from userType
left join quanxian on quanxian.userTypeName=userType.userTypeName
left join menu on menu.id=quanxian.menuId
group by userType.userTypeName,menu.parentNode,userType.id
order by userType.id
//userType加了个Id排序用
----------------------------
-- Author :DBA_Huangzj(發糞塗牆)
-- Date :2013-01-09 23:49:33
-- Version:
-- Microsoft SQL Server 2008 R2 (SP1) - 10.50.2500.0 (Intel X86)
-- Jun 17 2011 00:57:23
-- Copyright (c) Microsoft Corporation
-- Enterprise Edition on Windows NT 6.1 <X86> (Build 7601: Service Pack 1)
--
----------------------------
--> 测试数据:[userType]
if object_id('[userType]') is not null drop table [userType]
go
create table [userType]([id] int,[userTypeName] varchar(8))
insert [userType]
select 1,'管理员' union all
select 2,'置业顾问' union all
select 3,'财务' union all
select 4,'公司领导' union all
select 5,'普通员工'
--> 测试数据:[menu]
if object_id('[menu]') is not null drop table [menu]
go
create table [menu]([id] int,[parentNode] varchar(8),[childNode] varchar(8),[url] varchar(17),[orderID] int)
insert [menu]
select 1,'信息编辑','查找房源','bumen.aspx',1 union all
select 2,'信息编辑','客户登记','kehuDengji.aspx',2 union all
select 3,'信息编辑','客户管理','kehuManage.aspx',3 union all
select 4,'信息编辑','房源管理','FYManage.aspx',4 union all
select 5,'合同执行','收款登记','shoukuanDJ.aspx',5 union all
select 6,'合同执行','合同变更','hetongUpdate.aspx',6 union all
select 7,'合同执行','欠款催收','qiankuanCS.aspx',7 union all
select 8,'查询功能','房源查询','foundFY.aspx',8 union all
select 9,'查询功能','客户查询','KHCX.aspx