Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Nested common table expression

Author  Topic 

krisrajz
Starting Member

19 Posts

Posted - 2010-12-18 : 02:04:50
Is it possible to use nested common table expression?!

I am trying out something like this:

with RS1(Column1,Column2)
(
with RS2(RS2Column1,RS2Column2)
(
query
)
select * from RS2,RS3 where rs2.RS2Column1=RS3.Column1
)select count(*) from RS1

Any help would be appreciated and remembered forever?! :)

Thank you

Regards
Raj

Sachin.Nand

2937 Posts

Posted - 2010-12-18 : 04:54:38
Something like this

;with RS1(Column1,Column2)
as
(
select * from RS1
)
,RS2 as
(
select * from RS1,RS2 where RS1.Column1=RS2.Column1
)

select * from RS2


PBUH

Go to Top of Page

krisrajz
Starting Member

19 Posts

Posted - 2010-12-18 : 06:25:31
Thanks indeed

Raj
Go to Top of Page
   

- Advertisement -