I have two table want to join. Non of the rows in table A are in table B and non of the rows in table B are in A (thus using a Full Outer join). Need to report values from A and B on the same report line. At the same time, a key field on both A and B is used to join a third table C to get common data. The problem is I have to join C to either table A or B. If I join to A, then when B records show up I don't get the values from B on my report.
I can make it all work if I use a SQL command object because I can put an 'or' and join C to both A and B using the 'or'. Because of strange reasons I won't go into here I been told I can use the SQL command object - must use the Crystal Reports interface to join table al let CR create the SQL. So far unsuccessfull.
Here is the from clause I built for the SQL command but can't get CR to recreate this. The 'got cha' is the 'or' on the front of the sixth line from the bottom. CR don't seem to want to do this:
I can make it all work if I use a SQL command object because I can put an 'or' and join C to both A and B using the 'or'. Because of strange reasons I won't go into here I been told I can use the SQL command object - must use the Crystal Reports interface to join table al let CR create the SQL. So far unsuccessfull.
Here is the from clause I built for the SQL command but can't get CR to recreate this. The 'got cha' is the 'or' on the front of the sixth line from the bottom. CR don't seem to want to do this:
Code:
from (
select SOCIAL_SECURITY_NUM, mbe.Plan_Id,
Annual_Employee_PreTax_Cost,
Annual_Employer_PreTax_Cost,
Employer_PreTax_Cost,
Company_Tax_ID, YearID, calendar_name,
DEPCODE, Employee_PreTax_Cost
from member_benefit_elections mbe
) mbe [COLOR=blue]full outer join[/color] (
select SOCIAL_SECURITY_NUM, Plan_Id,
Annual_Employee_PreTax_Cost,
Annual_Employer_PreTax_Cost,
Employer_PreTax_Cost,
Company_Tax_ID, YearID, calendar_name,
DEPCODE, Employee_PreTax_Cost
from member_benefit_elections_changes
) mbec
on mbe.social_security_num =
mbec.social_security_num
and mbe.company_tax_id =
mbec.company_tax_id
and mbe.plan_id = mbec.plan_id
INNER JOIN qry_employee_only qeo
ON (mbe.SOCIAL_SECURITY_NUM = qeo.SOCIAL_SECURITY_NUM
AND mbe.DEPCODE = qeo.DEPCODE
AND mbe.Company_Tax_ID = qeo.Company_Tax_ID)
[COLOR=red]or[/color] (mbec.SOCIAL_SECURITY_NUM = qeo.SOCIAL_SECURITY_NUm
AND mbec.DEPCODE = qeo.DEPCODE
AND mbec.Company_Tax_ID = qeo.Company_Tax_ID)
INNER JOIN qryRptCompany cm
ON qeo.Company_Tax_ID = cm.Company_Tax_ID
AND qeo.Group_Tax_Id = cm.Group_Tax_ID