Right Join

zy_abc

Well-known member
Joined
May 2, 2003
Messages
67
Code:
Select  x,y,ID   from a  right join  b on a.rt=b.rt

I want to retreive the description of the ID from other table. How to do it? Please help me out.
 
Code:
SELECT Table1.ID, Table1.Name, Table2.Description FROM Table1 RIGHT JOIN Table2 ON Table1.ID = Table2.ID

Andy
 
a_jam_sandwich thanks for replying. The description of the ID comes from another table which Is "Table 3"
 
Code:
Table 1

X       ID
2       I001

Table 2

Y
1
2
3

Table 3
ID          Name
I001      QER
I002      TYU

Select  Y,ID   from Table1  right join  Table2 on Table1.x=Table2.Y

Instead of ID i would like to get the Name. How to go about for that a_jam_sandwich.
 
I cant quite see how table 3 relates to table1 or table2

Table1 right join to Table2 using Table1.x & Table2.y

Table3 ??? Relate to (Table1 or Table2)

Please explain abit more :)

Andy
 
Table 3 relates to Table 1.

Code:
When i execute Select  Y,ID   from Table1  right join  Table2 on Table1.x=Table2.Y

I get the output as 
Y            ID
1
2           I001
3

I want to get the Name of ID from Table 3

The output should be somewhat like this
Y               ID            Name
1
2             I001             QER
3
 
Try something like

SELECT Table1.ID, Table1.X, Table2.Y, Table3.Name
FROM (Table1 LEFT JOIN Table2 ON Table1.ID = Table2.ID) RIGHT JOIN Table3 ON Table1.ID = Table3.ID
 
Back
Top