From: Martin Gainty Date: December 30 2007 3:29pm Subject: RE: Help with query, (question simplified as last mail was very complicated to understand :)) List-Archive: http://lists.mysql.com/mysql/210610 Message-Id: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="_6f96e708-2a03-46d6-b241-726d5407b467_" --_6f96e708-2a03-46d6-b241-726d5407b467_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable the simple answer is and b.name=3D'name3' ?Bon ChanceMartin________________= ______________________________Disclaimer and confidentiality noteEverything= in this e-mail and any attachments relates to the official business of Sen= der. This transmission is of a confidential nature and Sender does not endo= rse distribution to any party other than intended recipient. Sender does no= t necessarily endorse content contained within this transmission.> Date: Su= n, 30 Dec 2007 13:54:32 +0100> From: mysql_list@stripped> To: mysql@stripped= ql.com> Subject: Re: Help with query, (question simplified as last mail was= very complicated to understand :))> > Richard a =E9crit :> > Sorry about m= y last email which was long and not clear.> > This is what I want to do> >>= > Join two tables on "code table1" =3D "code table3" where messageid =3D f= or > > example 28> >> > table 1 contains :> >> > message from messageid> > = ------------------------------------------> > message1 | code1 | 28> > mess= age2 | code1 | 28> > message3 | code1 | 28> > message4 | code1 | 29> >> >> = > table 2 contains> >> > name | code | num> > -----------------------------= ---------> > name1 | code2 | 1> > name2 | code1 | 2> > name3 | code1 | 3> >= > > If I do :> > SELECT a.message,,b.name FROM table1 a JOIN table2 b ON a.= code=3Db.code > > WHERE a.id=3D'28'> >> > I get :> > message | name> > ----= -----------------------> > message1 | name2> > message2 | name2> > message3= | name2> > message1 | name3> > message2 | name3> > message3 | name3> >> >>= > But all I want to get is :> >> > message | name> > ---------------------= ------> > message1 | name3> > message2 | name3> > message3 | name3> >> > If= I do :> > SELECT * FROM table2 WHERE code =3D 'code1' ORDER BY num DESC LI= MIT 1> >> > I get :> >> > name | code | num> > ----------------------------= ----------> > name3 | code1 | 3> >> > I now need to somehow combine the two= to get :> >> > message | name> > ---------------------------> > message1 |= name3> > message2 | name3> > message3 | name3> >> > Of course I have simpl= ified everything down to the minimum :)> >> > Thanks in advance,> >> > Rich= ard> >> >> As I have had no answer I presume that what I want to do is not = possible > or my question is not well explained. Anyhow I've rethought the = system > so I do not need to keep members information and now instead of ad= ding a > new entry I will now just change the existing one. I won't keep ol= d > members information in the database but I'll still have the database > = daily backups if I need the old information.> > -- > MySQL General Mailing = List> For list archives: http://lists.mysql.com/mysql> To unsubscribe: http= ://lists.mysql.com/mysql?unsub=3Dmgainty@stripped>=20 _________________________________________________________________ The best games are on Xbox 360. Click here for a special offer on an Xbox = 360 Console. http://www.xbox.com/en-US/hardware/wheretobuy/= --_6f96e708-2a03-46d6-b241-726d5407b467_--