Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2006

    Question Unanswered: Create a table from select Queries.


    I wanted to know a query which will create a final result table from a combination of select queries.

    The select query is like :
    1. select col1 , col2 , null from table1
    2. select null , col2 , null from table2
    3. select null , null , col3 from table 3.

    null are inserted as i wanted a single select query which will merge all the columns from all the tables and finally create a result table.

    Thanks in advance.

  2. #2
    Join Date
    Jun 2003
    select  * 
    into    resulttable
    from (
     select  col1 as col1, 
      col2  as col2, 
      null as col3 
     from  table1 
     union all
     select  null , 
      col2 , 
     from  table2
     union all
     select  null , 
      null , 
     from table3
    ) as tm
    I love cursor,though I never use it.Cos' I dont want to misuse it.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts