How best to join tables, which have different lengths on the same column values which exist in both tables?List of different values which have to be formatted differentlyArgmax in a ListHow to create a Table of Tables with indexed variablesRelational joining of tablesHow to use ImageMultiply[] over a list of strings?What is the Mathematica way of joining two tables?Is it possible to assign different values to a list of symbol, where they have the same argument?How to create a table of tables with different table lengths?How can I pair the values in 2 different tables of the same length together to make a table with 2 variables x, y?

Inset Square From a Rectangular Face

Why should P.I be willing to write strong LOR even if that means losing a undergraduate from his/her lab?

My father gets angry everytime I pass Salam, that means I should stop saying Salam when he's around?

Installing certbot - error - "nothing provides pyparsing"

What are these protruding elements from SU-27's tail?

Did Wernher von Braun really have a "Saturn V painted as the V2"?

!I!n!s!e!r!t! !b!e!t!w!e!e!n!

How to translate 脑袋短路 into English?

Why do aircraft leave cruising altitude long before landing just to circle?

Earliest evidence of objects intended for future archaeologists?

Why was ramjet fuel used as hydraulic fluid during Saturn V checkout?

My new Acer Aspire 7 doesn't have a Legacy Boot option, what can I do to get it?

Which basis does the wavefunction collapse to?

Check disk usage of files returned with spaces

What's the point of writing that I know will never be used or read?

Why is the name Bergson pronounced like Berksonne?

Radix2 Fast Fourier Transform implemented in C++

Starships without computers?

Independence of Mean and Variance of Discrete Uniform Distributions

What causes burn marks on the air handler in the attic?

Sinc interpolation in spatial domain

9 hrs long transit in DEL

Does the Temple of the Gods spell nullify critical hits?

Designing a prison for a telekinetic race



How best to join tables, which have different lengths on the same column values which exist in both tables?


List of different values which have to be formatted differentlyArgmax in a ListHow to create a Table of Tables with indexed variablesRelational joining of tablesHow to use ImageMultiply[] over a list of strings?What is the Mathematica way of joining two tables?Is it possible to assign different values to a list of symbol, where they have the same argument?How to create a table of tables with different table lengths?How can I pair the values in 2 different tables of the same length together to make a table with 2 variables x, y?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3












$begingroup$


I think my problem is pretty simple, and in SQL this would be trivial. I have two tables



TableOne = a, x1, b, x2, c, x3;
TableTwo = a, y1, c, y2 , a, y3, a, y4, b, y5, c,y6, c, y7


I want to abe able to join these two tables where the values of column 1 in both tables match such that:



DesiredResult = a, x1, a, y1, c, x3 , c, y2 , a, x1, a, y3, a, x1, a, y4, b, x2, b, y5, c, x3, c, y6, c, x3, c, y7


I've tried with both Select[] statements inside a Table[] structure and also looked into JoinAcross[] but haven't been able to acheive the desire effect. In SQL it would be simple, something like:



SELECT Col1.Table1, Col2.Table1, Col1.Table2, Col2.Table2, FROM table2 INNER JOIN table1 ON Col1.Table1 = Col1.Table2


Or something similar.










share|improve this question









$endgroup$




















    3












    $begingroup$


    I think my problem is pretty simple, and in SQL this would be trivial. I have two tables



    TableOne = a, x1, b, x2, c, x3;
    TableTwo = a, y1, c, y2 , a, y3, a, y4, b, y5, c,y6, c, y7


    I want to abe able to join these two tables where the values of column 1 in both tables match such that:



    DesiredResult = a, x1, a, y1, c, x3 , c, y2 , a, x1, a, y3, a, x1, a, y4, b, x2, b, y5, c, x3, c, y6, c, x3, c, y7


    I've tried with both Select[] statements inside a Table[] structure and also looked into JoinAcross[] but haven't been able to acheive the desire effect. In SQL it would be simple, something like:



    SELECT Col1.Table1, Col2.Table1, Col1.Table2, Col2.Table2, FROM table2 INNER JOIN table1 ON Col1.Table1 = Col1.Table2


    Or something similar.










    share|improve this question









    $endgroup$
















      3












      3








      3





      $begingroup$


      I think my problem is pretty simple, and in SQL this would be trivial. I have two tables



      TableOne = a, x1, b, x2, c, x3;
      TableTwo = a, y1, c, y2 , a, y3, a, y4, b, y5, c,y6, c, y7


      I want to abe able to join these two tables where the values of column 1 in both tables match such that:



      DesiredResult = a, x1, a, y1, c, x3 , c, y2 , a, x1, a, y3, a, x1, a, y4, b, x2, b, y5, c, x3, c, y6, c, x3, c, y7


      I've tried with both Select[] statements inside a Table[] structure and also looked into JoinAcross[] but haven't been able to acheive the desire effect. In SQL it would be simple, something like:



      SELECT Col1.Table1, Col2.Table1, Col1.Table2, Col2.Table2, FROM table2 INNER JOIN table1 ON Col1.Table1 = Col1.Table2


      Or something similar.










      share|improve this question









      $endgroup$




      I think my problem is pretty simple, and in SQL this would be trivial. I have two tables



      TableOne = a, x1, b, x2, c, x3;
      TableTwo = a, y1, c, y2 , a, y3, a, y4, b, y5, c,y6, c, y7


      I want to abe able to join these two tables where the values of column 1 in both tables match such that:



      DesiredResult = a, x1, a, y1, c, x3 , c, y2 , a, x1, a, y3, a, x1, a, y4, b, x2, b, y5, c, x3, c, y6, c, x3, c, y7


      I've tried with both Select[] statements inside a Table[] structure and also looked into JoinAcross[] but haven't been able to acheive the desire effect. In SQL it would be simple, something like:



      SELECT Col1.Table1, Col2.Table1, Col1.Table2, Col2.Table2, FROM table2 INNER JOIN table1 ON Col1.Table1 = Col1.Table2


      Or something similar.







      list-manipulation table






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 8 hours ago









      QuantumPenguinQuantumPenguin

      5692 silver badges18 bronze badges




      5692 silver badges18 bronze badges























          2 Answers
          2






          active

          oldest

          votes


















          4












          $begingroup$

          I think you should stay away from associations because your keys aren't unique. Maybe just go over all tuples of elements and pick those that match your criterion:



          Reap[Outer[If[#1[[1]] == #2[[1]], Sow@Join@##] &, TableOne, TableTwo, 1]][[2, 1]]

          (* a, x1, a, y1, a, x1, a, y3, a, x1, a, y4, b, x2, b, y5, c, x3, c, y2,
          c, x3, c, y6, c, x3, c, y7 *)





          share|improve this answer









          $endgroup$














          • $begingroup$
            That'll do it, thanks again Roman.
            $endgroup$
            – QuantumPenguin
            8 hours ago


















          2












          $begingroup$

          assocOne = AssociationThread[First /@ #, #] & @ TableOne;

          f = Join[assocOne[First @ #], #]&;

          Map[f] @ TableTwo



          a, x1, a, y1, c, x3, c, y2, a, x1, a, y3, a, x1, a, y4, b,
          x2, b, y5, c, x3, c, y6, c, x3, c, y7







          share|improve this answer









          $endgroup$














          • $begingroup$
            Also a very nice solution, +1!
            $endgroup$
            – QuantumPenguin
            3 hours ago













          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "387"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f203913%2fhow-best-to-join-tables-which-have-different-lengths-on-the-same-column-values%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          4












          $begingroup$

          I think you should stay away from associations because your keys aren't unique. Maybe just go over all tuples of elements and pick those that match your criterion:



          Reap[Outer[If[#1[[1]] == #2[[1]], Sow@Join@##] &, TableOne, TableTwo, 1]][[2, 1]]

          (* a, x1, a, y1, a, x1, a, y3, a, x1, a, y4, b, x2, b, y5, c, x3, c, y2,
          c, x3, c, y6, c, x3, c, y7 *)





          share|improve this answer









          $endgroup$














          • $begingroup$
            That'll do it, thanks again Roman.
            $endgroup$
            – QuantumPenguin
            8 hours ago















          4












          $begingroup$

          I think you should stay away from associations because your keys aren't unique. Maybe just go over all tuples of elements and pick those that match your criterion:



          Reap[Outer[If[#1[[1]] == #2[[1]], Sow@Join@##] &, TableOne, TableTwo, 1]][[2, 1]]

          (* a, x1, a, y1, a, x1, a, y3, a, x1, a, y4, b, x2, b, y5, c, x3, c, y2,
          c, x3, c, y6, c, x3, c, y7 *)





          share|improve this answer









          $endgroup$














          • $begingroup$
            That'll do it, thanks again Roman.
            $endgroup$
            – QuantumPenguin
            8 hours ago













          4












          4








          4





          $begingroup$

          I think you should stay away from associations because your keys aren't unique. Maybe just go over all tuples of elements and pick those that match your criterion:



          Reap[Outer[If[#1[[1]] == #2[[1]], Sow@Join@##] &, TableOne, TableTwo, 1]][[2, 1]]

          (* a, x1, a, y1, a, x1, a, y3, a, x1, a, y4, b, x2, b, y5, c, x3, c, y2,
          c, x3, c, y6, c, x3, c, y7 *)





          share|improve this answer









          $endgroup$



          I think you should stay away from associations because your keys aren't unique. Maybe just go over all tuples of elements and pick those that match your criterion:



          Reap[Outer[If[#1[[1]] == #2[[1]], Sow@Join@##] &, TableOne, TableTwo, 1]][[2, 1]]

          (* a, x1, a, y1, a, x1, a, y3, a, x1, a, y4, b, x2, b, y5, c, x3, c, y2,
          c, x3, c, y6, c, x3, c, y7 *)






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 8 hours ago









          RomanRoman

          15.6k1 gold badge21 silver badges52 bronze badges




          15.6k1 gold badge21 silver badges52 bronze badges














          • $begingroup$
            That'll do it, thanks again Roman.
            $endgroup$
            – QuantumPenguin
            8 hours ago
















          • $begingroup$
            That'll do it, thanks again Roman.
            $endgroup$
            – QuantumPenguin
            8 hours ago















          $begingroup$
          That'll do it, thanks again Roman.
          $endgroup$
          – QuantumPenguin
          8 hours ago




          $begingroup$
          That'll do it, thanks again Roman.
          $endgroup$
          – QuantumPenguin
          8 hours ago













          2












          $begingroup$

          assocOne = AssociationThread[First /@ #, #] & @ TableOne;

          f = Join[assocOne[First @ #], #]&;

          Map[f] @ TableTwo



          a, x1, a, y1, c, x3, c, y2, a, x1, a, y3, a, x1, a, y4, b,
          x2, b, y5, c, x3, c, y6, c, x3, c, y7







          share|improve this answer









          $endgroup$














          • $begingroup$
            Also a very nice solution, +1!
            $endgroup$
            – QuantumPenguin
            3 hours ago















          2












          $begingroup$

          assocOne = AssociationThread[First /@ #, #] & @ TableOne;

          f = Join[assocOne[First @ #], #]&;

          Map[f] @ TableTwo



          a, x1, a, y1, c, x3, c, y2, a, x1, a, y3, a, x1, a, y4, b,
          x2, b, y5, c, x3, c, y6, c, x3, c, y7







          share|improve this answer









          $endgroup$














          • $begingroup$
            Also a very nice solution, +1!
            $endgroup$
            – QuantumPenguin
            3 hours ago













          2












          2








          2





          $begingroup$

          assocOne = AssociationThread[First /@ #, #] & @ TableOne;

          f = Join[assocOne[First @ #], #]&;

          Map[f] @ TableTwo



          a, x1, a, y1, c, x3, c, y2, a, x1, a, y3, a, x1, a, y4, b,
          x2, b, y5, c, x3, c, y6, c, x3, c, y7







          share|improve this answer









          $endgroup$



          assocOne = AssociationThread[First /@ #, #] & @ TableOne;

          f = Join[assocOne[First @ #], #]&;

          Map[f] @ TableTwo



          a, x1, a, y1, c, x3, c, y2, a, x1, a, y3, a, x1, a, y4, b,
          x2, b, y5, c, x3, c, y6, c, x3, c, y7








          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 5 hours ago









          kglrkglr

          212k10 gold badges242 silver badges485 bronze badges




          212k10 gold badges242 silver badges485 bronze badges














          • $begingroup$
            Also a very nice solution, +1!
            $endgroup$
            – QuantumPenguin
            3 hours ago
















          • $begingroup$
            Also a very nice solution, +1!
            $endgroup$
            – QuantumPenguin
            3 hours ago















          $begingroup$
          Also a very nice solution, +1!
          $endgroup$
          – QuantumPenguin
          3 hours ago




          $begingroup$
          Also a very nice solution, +1!
          $endgroup$
          – QuantumPenguin
          3 hours ago

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Mathematica Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f203913%2fhow-best-to-join-tables-which-have-different-lengths-on-the-same-column-values%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Sahara Skak | Bilen | Luke uk diar | NawigatsjuunCommonskategorii: SaharaWikivoyage raisfeerer: Sahara26° N, 13° O

          The fall designs the understood secretary. Looking glass Science Shock Discovery Hot Everybody Loves Raymond Smile 곳 서비스 성실하다 Defas Kaloolon Definition: To combine or impregnate with sulphur or any of its compounds as to sulphurize caoutchouc in vulcanizing Flame colored Reason Useful Thin Help 갖다 유명하다 낙엽 장례식 Country Iron Definition: A fencer a gladiator one who exhibits his skill in the use of the sword Definition: The American black throated bunting Spiza Americana Nostalgic Needy Method to my madness 시키다 평가되다 전부 소설가 우아하다 Argument Tin Feeling Representative Gym Music Gaur Chicken 일쑤 코치 편 학생증 The harbor values the sugar. Vasagle Yammoe Enstatite Definition: Capable of being limited Road Neighborly Five Refer Built Kangaroo 비비다 Degree Release Bargain Horse 하루 형님 유교 석 동부 괴롭히다 경제력

          19. јануар Садржај Догађаји Рођења Смрти Празници и дани сећања Види још Референце Мени за навигацијуу