Thursday, May 7, 2015

Recursive CTE Work Flow

Hi Latheesh,

Thanks for your referenced link http://ift.tt/1us1XVM

i want to know detailed information of query.

like

SELECT   ID
            ,Name
            ,MgrID
            ,nLevel = 1
            ,Family = ROW_NUMBER() OVER (ORDER BY Name)
    FROM Employee
    WHERE MgrID IS NULL

this will return one row

then

this level+1 will increase the level 1,2,3..

but in this join is for CTE and Table . how the join works here?, because CTE will return only one value but the table has more value of mgrid so please explain me elbroate.


GVRSPK VENI


No comments:

Post a Comment