Skip to main content
Question

merge of two tables in to one tables

  • September 6, 2023
  • 0 replies
  • 168 views

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
------------------------------
This topic has been closed for replies.

MarkShnierYou
Forum|alt.badge.img+24

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
------------------------------