Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to do a SQL type operation???

  • To: mathgroup at smc.vnet.net
  • Subject: [mg64359] Re: How to do a SQL type operation???
  • From: "Valeri Astanoff" <astanoff at yahoo.fr>
  • Date: Tue, 14 Feb 2006 01:31:35 -0500 (EST)
  • References: <dspfnb$cf2$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Here is a DIY solution :

In[1]:=myJoin[t1_List,t2_List,keyPosition_:1]:=
    Module[{sel},
      sel[x_]:=Rest@First@Select[t2,#[[1]] == x&];
      Join[#,sel[#[[keyPosition]]]]& /@ t1
      ];

Example :

In[2]:=t1={{1,11},{2,21},{2,22},{3,31},{4,41}};

In[3]:=t2={{1,211,212},{2,221,222},{3,231,232},{4,241,242}};

In[4]:=myJoin[t1,t2]

Out[4]={{1,11,211,212},{2,21,221,222},{2,22,221,222},{3,31,231,232},{4,41,241,242}}


hth

v.a.


  • Prev by Date: Re: Descarta2D
  • Next by Date: Re: Awesome PDF writer
  • Previous by thread: Re: How to do a SQL type operation???
  • Next by thread: Re: How to do a SQL type operation???