SQL Question

anonymous_at_discussions.microsoft.com
Date: 08/23/04


Date: Mon, 23 Aug 2004 08:09:47 -0700

Hi, everyone:

I was trying to create a tempory table and then join it
with other existing tables to do some query.
I know in DB2 SQL you can do the following:

WITH temp (var1 var2) as
(
select field1, field2
from table1
)

select
tb1.field2,
tb2.var2

from
temp as tb1,
table2 as tb2

where
tb1.var1 = tb2.field1

How do I do this in SQL server ?

Thanks!!

F.S.