Forum Discussion

Venkata_krishna's avatar
Venkata_krishna
Qrew Member
8 months ago

merge of two tables in to one tables

HI 

I'm trying to merge two tables that have similar primary keys I have uploaded the data in one table it was smooth but when I tried with the other table it showed that I have many duplicates and same time I want to pull that data from both the tables to one single table.



------------------------------
krishna
------------------------------

1 Reply

  • Here is an answer I recently gave to a client for a similar situation.

    I don't have that exact code handy in any apps, but the idea would be to set up a custom Key field for the target table in the format like A-1234 and B-1234, representing the records from tables A and B, and the Record ID#'s of each table.  The prefix ensures that the custom Key would never duplicate across two tables.  Make those as formula fields in each source table.
    Create two saved table to table copy imports to populate the target table.
     
    Then the code would be something like this, (not tested for syntax) 
    var text Purge =  URLRoot() & "db/" & [_DBID_CONSOLIDATED_TABLE] & "?act=API_PurgeRecords";
    var text ImportOne = URLRoot() & "db/" & [_DBID_CONSOLIDATED_TABLE] & ?act=API_RunImport&ID-=10";
    var text ImportTwo = URLRoot() & "db/" & [_DBID_CONSOLIDATED_TABLE] & ?act=API_RunImport&ID-=11";
    var text DisplayTableHomePage = URLRoot() & "db/" & [_DBID_CONSOLIDATED_TABLE] & "?a=td":
    $Purge 
    & "&rdr=" & URLEncode($ImportOne)
    & URLEncode("&rdr=" & URLEncode($ImportTwo))
    & URLEncode(URLEncode("&rdr=" & URLEncode($DisplayTableHomePage)))


    ------------------------------
    Mark Shnier (Your Quickbase Coach)
    mark.shnier@gmail.com
    ------------------------------