Showing posts with label recursive. Show all posts
Showing posts with label recursive. Show all posts

Friday, February 17, 2012

Drilling down a recursive hierarchy

Hi,

We have two dimensions: User and Employee. Employees are recursive - each Employee can have several Employees that report to him/her and each Employee as a (or no) boss.

If a User has the right to access a specific employee he/she also has the rights to access his/her staff.

The following query returns all Employees a specific user has rights for.

select

filter([Employee].[Employee].members,[Measures].[UserEmployeeLink] > 0 ) on 0

from

[REPL]

where

([Measures].[UserEmployeeLink], StrToTuple("[User].[Login].&[XYZ]") )

How to modify this query that also all (directly and indirectly) subordinated employees of the queried employees are returned ?

There might exist cases, where a user has rights for employees at different levels, for instance for A and D.

+ B

|

A --| C

|

+ D

In this case, the query should return all, A, B, C and D.

Whishes,

Manfred

If I understand your question correctly, I think your looking for the DESCENDANTS function with the LEAVES parameter.

B.

DrillDown on Recursive Data

How can I do drilldown on recursive data?
I have a table with products that have parent products
Eg:
ProductID ParentProductID
1
2 1
3 1
4 2
I want to drill down on all the levels.
Thanks
--
Matias from Argentina!Look here:
http://groups-beta.google.com/groups?q=sql+server+recursive+select
--
Cheers,
'(' Jeff A. Stucker
\
Business Intelligence
www.criadvantage.com
---
"matiasls" <matiasls@.hotmail.com> wrote in message
news:2BF2A852-9F50-47A6-9369-AE00F89C50FF@.microsoft.com...
> How can I do drilldown on recursive data?
> I have a table with products that have parent products
> Eg:
> ProductID ParentProductID
> 1
> 2 1
> 3 1
> 4 2
>
> I want to drill down on all the levels.
> Thanks
> --
> Matias from Argentina!