MySQL Forums
Forum List  »  PHP

Re: MySQL query question
Posted by: Reeju Vava
Date: March 14, 2009 04:23AM

lan w Wrote:
-------------------------------------------------------
> Hi,
>
> I have two tables, the sample structure and data
> of table A is:
> id, awardname1,awardname2,awardname3
> 1 abc def ghi
>
> the sample structure and data of table B is:
> awardname awardcode
> abc x1
> def x2
> ghi x3
>
> Is there a query I can use to get the awardcode
> for each row in table A?
> the result like:
> id, awardname1, awardcode1, awardname2,
> awardcode2, awardname3, awardcode3
> 1 abc x1 def x2
> ghi x3
>
> Any help will be appreciated!
> Lan











select a.id,a.awardname1,b.awardcode,a.awardname2,c.awardcode,a.awardname3,d.awardcode from tableA a,tableB b,tableB c,tableB d where a.awardname1=b.awardname and a.awardname2=c.awardname and a.awardname3=d.awardname;

Options: ReplyQuote


Subject
Written By
Posted
February 06, 2009 03:34PM
February 06, 2009 05:41PM
Re: MySQL query question
March 14, 2009 04:23AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.