Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2007
    Posts
    28

    Unanswered: create table from query results

    Hi everybody need help on the possibility creating a new table from the results of a view or query? below is my table named table1


    ID col1 col2

    1 a a
    2 b d
    3 c f

    this would be my new table named table2

    ID col1 col2 col3

    1 a a aa
    2 b d bd
    3 c f cf

    this new table has an additional column by concatenating col1+col2
    tried this procedure but is not working

    CREATE TABLE AS (SELECT ID, COL1, COL2, COL1+COL2) TABLE2

    thanks

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    are you sure you need to store the concatenation in a separate table?
    Code:
    SELECT ID, COL1, COL2, COL1+COL2 AS COL3
    INTO TABLE2
    FROM TABLE1
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jun 2007
    Posts
    28
    thanks Rudy

    yes I'll be storing the concatenated field in a new table

    will that procedure create automatically the table2 even if i don't use CREATE TABLE?

    alex

Posting Permissions

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