Re: SQL Question

anonymous_at_discussions.microsoft.com
Date: 09/04/04


Date: Sat, 4 Sep 2004 11:16:53 -0700

Thanks a lot!!!

>-----Original Message-----
>>>
>WITH temp (var1 var2) as
>(
>select field1, field2
>from table1
>)
><<
>
>above syntax's equivalent in sql server is:
>
>select field1 as var1,field2 as var2 into temp from table1
>
>--the query remain the same :
>select tb1.field2, tb2.var2
>from
>temp as tb1,
>table2 as tb2
>where
>tb1.var1 = tb2.field1
>
>--using ansi syntax you can have query as:
>
>select tb1.var2, tb2.var2
>from temp as tb1 join table2 as tb2
>on tb1.var1 = tb2.field1
>
>--without creating the temporary table you can make use
of SELECT statement
>as an inline view as follows:
>
>select tb1.field2, tb2.var2
>from (select field1,field2 from table1) as tb1 join
table2 as tb2
>on tb1.field1 = tb2.field1
>
>
>--
>Vishal Parkar
>vgparkar@yahoo.co.in | vgparkar@hotmail.com
>
>
>.
>



Relevant Pages

  • Re: Problem with update
    ... Now I want to UPDATE this records using a Second Table "Table2" ... If, in table1, I've AAA I want to search in table2 the value of type AAA in ... The only way to guarantee the order in which rows are returned is to ... the two inline view results. ...
    (comp.databases.oracle.server)
  • Re: SQL select and compare help
    ... select distinct color from table1 a ... (select * from table2 b ... Vishal Parkar ...
    (microsoft.public.sqlserver.programming)