Join 2 tables at backend

Hi,

I am not able to join 2 tables at backend, does thoughtspot TQL doesn't support joining two tables at backend?

I tried to create Relationship between 2 tables. Can we update one column from another table using relationship here?

7replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Hi Sanyam.

    When we talk about joining two tables, we're usually talking about creating a Primary Key > Foreign Key relationship using TQL. Here is some documentation on how to do that: 
    https://docs.thoughtspot.com/5.1/admin/loading/constraints.html

    What are you trying to accomplish? Would it help to have someone meet you in our virtual Office Hours?

    If so, you can sign up here: https://thoughtspotcs-officehours.youcanbook.me/

    Reply Like
  • Hi Alicia,

    Thanks for your reply. 

    Using TQl, can we do below things:

    1. Creating backup table. (As we do in SQL: create table <Backup_Tablename> as (select * from <Tablename>);

     

    2. Also can we update the column of 1 table from another table using some common joining columns?

    Reply Like
  • For 1. You can use insert into : insert into <backupTablename> select * from <Tablename>;

    Reply Like
  • Hi Rajiv,

    Thanks for your reply. 

    This is basically Inserting data into 1 table from another table. So can we insert data into selected columns from similar selected columns of another table ?

    e.g. i tried like:

    insert into <table1> (table1.col1, table1.col3, table1.col5) select table2.col1, table2.col3, table2.col5 from <table2>;

    But it didn't worked for me. 

    Reply Like
  • You can use "select into" in that case : select <column 1>, <column 2> into <backupTable> from <TableName> ;

    Reply Like
  • Hi Rajiv, 

    It worked. Thanks.

    I have real time challenge. A table has more than 100+ cols and 200+ M rows. There is request to add another Indicator col.

    So Adding new column and getting incremental load is fine. 

    But issue is how to do history correction here. Cann't we updated new col using PK in backend (TQL)?

    As of now i am doing full truncate and load which is really time consuming.

    Reply Like
  • Hey Sanyam.. Glad that it worked.. Can you please mark this as answered and open a new thread for this new question.. This would help people who are reading this in the future..

    Reply Like
Like Follow
  • Status Answered
  • 9 mths agoLast active
  • 7Replies
  • 107Views
  • 3 Following