>I have 3 tables; OH (Order Headers), MOC (Orders), and RQ (Requirements).
>
>I want to pull all OH, MOC, and RQ rows. So far I have the code below.
>
>
>SELECT OH.*, MOC.*, RQ.*
> FROM OH
> JOIN MOC ON MOC_OHTYPE = OH.OH_TYPE AND MOC.MOC_OHNUMBER = OH.OH_NUMBER
> JOIN RQ ON MOC.MOC_OHNUMBER = RQ.RQ_MOCNUMBER AND MOC.MOC_REF_NO = RQ.RQ_MOCREFNO
> WHERE OH.OH_CUKEY = 'DAT001' AND OH.OH_CUST_PO_NUM = '955129'
>
>
>
>The problem is that on the MOC record, some rows have 'MISCELLANEOUS' or '70-MISCELLANEOUS' in the MOC_PART_NO columns. For those rows there will be no RQ row. I'm not sure how to code this so that I get back all MOC rows regardless of the
>RQ table.
>
>Could use some help.
>
>Thanks
Try using
LEFT JOIN with RQ table.
If it's not broken, fix it until it is.
My Blog