Insert a field from a table to another.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • leodrums
    New Member
    • Nov 2006
    • 4

    Insert a field from a table to another.

    I have to tables with different names, and I need to insert into the destination table a field from the origin table that has the same name as the field in the destination table.
  • iburyak
    Recognized Expert Top Contributor
    • Nov 2006
    • 1016

    #2
    Insert into destination_tab le (field1,field2)
    Select field1, field2 from origin_table where .....

    Comment

    • leodrums
      New Member
      • Nov 2006
      • 4

      #3
      Originally posted by iburyak
      Insert into destination_tab le (field1,field2)
      Select field1, field2 from origin_table where .....
      Thank's, but still doesn't work. It says "field valuer required". Is there something missing, how would be the complete Syntax.

      Thank's a lot.

      Comment

      • iburyak
        Recognized Expert Top Contributor
        • Nov 2006
        • 1016

        #4
        You have to give me table definitions and full statement executed so I would be able to help.

        Comment

        • leodrums
          New Member
          • Nov 2006
          • 4

          #5
          The structure of both tables is exactly the same. And right now i need to copy only one field of the origin table into the destination table. The field format is currency.

          Do you need any more information?

          Thank's.

          Comment

          • Taftheman
            New Member
            • Nov 2006
            • 93

            #6
            Try aliases, this might be the cause if the fields from each table are the same

            Insert into Table1(Field1, Field2)
            Select table2.Field1, table2.Field0
            From Table2
            Where your code here

            Comment

            • leodrums
              New Member
              • Nov 2006
              • 4

              #7
              Thank's a lot!!!

              That worked.

              Comment

              Working...