Try something like is:

select a.Name as PL_Name,b.Name as PC_Name,c.Name as PA_Name from
(select * from table1,table2 where table1.ID=table2.PL) a,
(select * from table1,table2 where table1.ID=table2.PC) b,
(select * from table1,table2 where table1.ID=table2.PA) c
where a.description=b.description and b.description=c.description

-Yayati

Tariq Murtaza wrote:

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


















-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to