Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Query Question
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Titre:
Divers
Thread ID:
01441330
Message ID:
01441331
Vues:
35
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform