Re: stuck with simple query..... Plz have a look

From: Date: Thu, 08 Apr 2004 00:15:47 +0000
Subject: Re: stuck with simple query..... Plz have a look
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-182753@lists.php.net to get a copy of this message
You need to do a join. SELECT table1.ID AS PL_NAME, table1.ID AS PC_NAME, table1.ID AS PA_NAME FROM table1, table2 WHERE (table2.PL = table1.ID) AND (table2.PC = table1.ID) and (table2.PA = table1.ID) ; Or something like that. Sorry I couldn't be of more help. Respectfully, Ligaya Turmelle "Tariq Murtaza" <tariq@smeda.org.pk> wrote in message news:407482E6.3060603@smeda.org.pk... > We have two tables > > Table1: > ------------------------- > ID | Name > ------------------------ > 1 | name1 > 2 | name2 > 3 | name3 > 4 | name4 > > > Table2: > -------------------------------------------------------------------------- ------------------------- > PL | PC | PA | Description > -------------------------------------------------------------------------- ------------------------- > 1 | 2 | 4 | Some description > for Project 1 > 2 | 3 | 1 | Some description > for Project 2 > 1 | 2 | 4 | Some description > for Project 3 > 4 | 1 | 3 | Some description > for Project 4 > 3 | 1 | 4 | Some description > for Project 5 > 2 | 3 | 1 | Some description > for Project 6 > > > I need the output like.......... > > -------------------------------------------------------------------------- ------- > PL-Name | PC-Name | PA-Name > -------------------------------------------------------------------------- ------- > name1 | name2 | name4 > name2 | name3 | name1 > name1 | name2 | name4 > name4 | name1 | name3 > name3 | name1 | name4 > name2 | name3 | name1 > > > Please guide me how can i achieve this kind of result set. > Regards, > > Tariq > > > > > > > > > > > > > > > > >

« previous php.general (#182753) next »