• You can use multiple ctes like this

    create table #temp (ID int, Name varchar(20))

    insert into #temp

    values

    (10, 'Helen'),

    (20, 'Joe'),

    (30, 'Blake');

    ;with cte as

    (select * from #temp)

    ,

    cte1 as

    (

    select * from #temp

    union all

    select * from cte

    )

    select * from cte1

    for more details visit this site

    http://msdn.microsoft.com/en-us/library/ms175972.aspx

    Malleswarareddy
    I.T.Analyst
    MCITP(70-451)