天天看點

some useful select statement of SQL

1. Temporary Table

    select __

    into Temp_Table

    from __

   where__

2. Recursive Select

   with Sub(f1,f2)

   as

  (select f11,f22

   from table1

  where __

  union all

  select f111,f222

  from table2

  where __

 )

3.Multi_table join

  select __

  from (select __ from table1 as A inner join table2 as B on A.f1=B.f1 where __) as C

            right outer join table3 as D on C.f1=D.f1

  where __

  group by __

  order by__