• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 814
  • Last Modified:

How to do two joins in one query?

Hi

I would like to do a join with the follow 3 tables:

RequisitionHeader RH
JobHeader JH
PurchaseProcessHeade PPH

The joins:
-RH and JH on RH.field1 = PPH.field1
-RH and PPH on RH.field2 = PPH.field2

The current non-working syntax:

FROM
RequisitionHeader RH INNER JOIN JobHeader JH,
RequisitionHeader RH INNER JOIN  PurchaseProcessHeade PPH
ON RH.JobNumber = JH.JobNumber AND RH.PurchaseProcessNumbe = PPH.PurchaseProcessNumbe

Please help!!
0
minichicken
Asked:
minichicken
1 Solution
 
TimCotteeCommented:
Hi minichicken,

 FROM
 RequisitionHeader RH INNER JOIN JobHeader JH,
 ON RH.JobNumber = JH.JobNumber
RequisitionHeader RH INNER JOIN  PurchaseProcessHeade PPH
ON RH.PurchaseProcessNumbe = PPH.PurchaseProcessNumbe


Tim Cottee
0
 
minichickenAuthor Commented:
Hi Tim

that didnt really work, i think there is a syntax error with the common in the wrong place.
and it also dont accect the RH been called twice.

thanks
0
 
Krn25Commented:
Hi

Try

FROM
 RequisitionHeader RH INNER JOIN JobHeader JH
 ON RH.JobNumber = JH.JobNumber
 INNER JOIN  PurchaseProcessHeade PPH
ON RH.PurchaseProcessNumbe = PPH.PurchaseProcessNumbe

krn
0
 
minichickenAuthor Commented:
ok that works :)

thanks
0
 
chhapia_chintakCommented:
HI

try this

Select <<entities required>> from
FROM  RequisitionHeader RH
JOIN JobHeader JH  ON RH.JobNumber = JH.JobNumber
JOIN  PurchaseProcessHeade PPH ON RH.PurchaseProcessNumbe = PPH.PurchaseProcessNumbe

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now