Question about INSERT clause.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • seahorse123
    New Member
    • Sep 2005
    • 1

    #1

    Question about INSERT clause.

    I want to insert records to the table1 from variable and table2, for example:

    "insert into table1 (column1,column 2,column3) from ('abcd',select a,b from table2)"

    where insert variable 'abcd' into column1, and insert a,b from table2 into column2,column3 , how to write the correct insert statement? thanks.
  • richasaraf
    New Member
    • Aug 2005
    • 23

    #2
    INSERT Statement

    Originally posted by seahorse123
    I want to insert records to the table1 from variable and table2, for example:

    "insert into table1 (column1,column 2,column3) from ('abcd',select a,b from table2)"

    where insert variable 'abcd' into column1, and insert a,b from table2 into column2,column3 , how to write the correct insert statement? thanks.
    Hello there !
    The query should be written as follows :

    insert into table1 values ( select 'abcd', table2.a, table2.b from table2 );

    In place of 'abcd' you can specify any variable name you want to insert !

    :)
    Last edited by richasaraf; Dec 6 '05, 08:56 AM.

    Comment

    Working...