How to copy from two different data into one table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • paranduet
    New Member
    • Jun 2010
    • 2

    How to copy from two different data into one table

    Hi, Anyone can help me about on sql query? I have two table "client" and "client_mat ". where their field are same and two table data must be same, But In here client table has some data and client_mat has large number of data.

    In client table data also exits on the client_mat table. Now I want to copy non-similar (client.id!=cli ent_mat.id) data from client_mat to client table. But how to do it.

    I wait for answer. Please suggest me.
  • bijaya012
    New Member
    • Jun 2010
    • 2

    #2
    Originally posted by paranduet
    Hi, Anyone can help me about on sql query? I have two table "client" and "client_mat ". where their field are same and two table data must be same, But In here client table has some data and client_mat has large number of data.

    In client table data also exits on the client_mat table. Now I want to copy non-similar (client.id!=cli ent_mat.id) data from client_mat to client table. But how to do it.

    I wait for answer. Please suggest me.
    Hi,
    If you want create a temporary to which have non similar record you can use following query.

    create table temptab select t2.* from client t1 , client_mat t2 where t2.id!=t1.id;

    as all the data of client is in client_mat too

    Comment

    • paranduet
      New Member
      • Jun 2010
      • 2

      #3
      Originally posted by bijaya012
      Hi,
      If you want create a temporary to which have non similar record you can use following query.

      create table temptab select t2.* from client t1 , client_mat t2 where t2.id!=t1.id;

      as all the data of client is in client_mat too
      Thanks for your help.
      Actually I am not want to create a temporary table. I want to copy different data from client_mat and paste on client table.
      please help me.

      Comment

      • iohos
        Banned
        New Member
        • Jul 2010
        • 45

        #4
        SELECT *
        INTO new_table_name [IN externaldatabas e]
        FROM old_tablename

        Comment

        • iohos
          Banned
          New Member
          • Jul 2010
          • 45

          #5
          SELECT column_name(s)
          INTO new_table_name [IN externaldatabas e]
          FROM old_tablename

          Comment

          Working...