I have a query that uses a join hint to force a HASH join between a table and a view. I noticed that there was missing data in the query when I use the query hint to force the HASH join. When I run the two queries there 65 NULL rows (out of about 40,000) in the HASH join query that have data in the query without a join hint. I did not think that using a query hint would impact the rows that were returned. I have not been able to find anything in common among the rows that are not returned by the query using the HASH join.
This is the query that I am using:
SELECT denial_letter.case_id, denial_letter.mailed_date FROM [hpXr_Stage].[psa].[PSA_CAE_OLTP_ORG_CASE] org_case
LEFT HASH JOIN hpXr_Stage.stg.SHS_V_CAE_UM_DENIAL_LETTER denial_letter ON denial_letter.case_id = org_case.id
AND denial_letter.mailed_date_order = 1
AND denial_letter.create_date_order = 1
SELECT denial_letter.case_id, denial_letter.mailed_date FROM [hpXr_Stage].[psa].[PSA_CAE_OLTP_ORG_CASE] org_case
JOIN hpXr_Stage.stg.SHS_V_CAE_UM_DENIAL_LETTER denial_letter ON denial_letter.case_id = org_case.id
AND denial_letter.mailed_date_order = 1
AND denial_letter.create_date_order = 1