"Imran" <[EMAIL PROTECTED]> wrote on 01/18/2006 03:13:08 PM:

> Hello All:
> 
> I need to join three tables but I am not sure how to structure the 
query. 
> I need to join table1 to table2 and then join table3 to this result set.
> 
> So like (table1 join table2) join table3.
> 
> Table1 and Table2 will be joined on ProdNo,CustNo and Branch. Table3 
will be
> joined to the result set by CustNo and Branch.
> 
> Best regards
> Imran. 
> 

Assuming INNER JOINs:

SELECT *
FROM table1 t1
INNER JOIN table2 t2
  ON t1.ProdNo = t2.ProdNo
  AND t1.CustNo = t2.CustNo
  AND t1.Branch = t2.Branch
INNER JOIN table3 t3
  ON t1.CustNo = t3.CustNo
  AND t1.Branch = t3.Branch;

If this doesn't fit you needs, you need to describe your situation with 
MORE DETAILS and I or someone else will try again.

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Reply via email to