Hello,
I am trying to pull data that is null using the selection expert.
I have a report that uses a table that has description fields that I joined with my patient table so I can show the description on the report. The problem I am having is if the actual field in the patient table is missing the patient's info does not show.
Here is what I have in the selection expert:
Here is my sql query maybe my joins are off:
How can I write this to show all the data even if one of the fields are NULL. For example if Patient education is blank but everything else is there The patient's data is not pulling at all.
Thanks in advance.
I am trying to pull data that is null using the selection expert.
I have a report that uses a table that has description fields that I joined with my patient table so I can show the description on the report. The problem I am having is if the actual field in the patient table is missing the patient's info does not show.
Here is what I have in the selection expert:
Code:
{Global_Code_Sex.category} = "SEX" and
{Global_Code_Occu.category} = "OS" and
{Global_Code_Stud.category} = "SS" and
{Global_Code_Educ.category} = "ED" and
{Global_Code_LA.category} = "LA" and
{Global_Code_RS.category} = "RS" and
{Global_Code_Legal.category} = "CRTDISP" and
{Global_Code_primIn.category} = "PINCOSRC" and
{Global_Code_Race.category} = "R" and
{Global_Code_MStatus.category} = "MS" and
{Global_Code_Sal.category} = "SA"
Here is my sql query maybe my joins are off:
Code:
SELECT "Patient"."patient_id", "Patient"."fname", "Patient"."lname", "Patient"."addr_1", "Patient"."episode_id", "Patient"."dob", "Patient"."addr_2", "Patient"."city", "Patient"."state", "Patient"."zip", "Patient"."county", "Patient"."home_phone", "Patient"."work_phone", "Patient"."other_phone", "Patient"."occ_1", "Patient"."employer_name", "Patient_Custom"."incopers", "Intake_Med_Hx"."hearing_impaired", "Intake_Med_Hx"."movement_impaired", "Intake_Med_Hx"."sight_impaired", "Intake_Med_Hx"."speech_impaired", "Intake_Med_Hx"."learning_impaired", "Intake_Med_Hx"."pregnant", "Patient"."no_of_dependents", "Patient"."num_in_household", "Patient"."household_income", "Global_Code_MStatus"."category", "Global_Code_Race"."category", "Global_Code_Sex"."category", "Global_Code_Occu"."category", "Global_Code_Stud"."category", "Global_Code_Educ"."category", "Global_Code_LA"."category", "Global_Code_RS"."category", "Global_Code_primIn"."category", "Global_Code_Legal"."category", "Psychiatric_History"."event_name", "Global_Code_Sal"."category", "Global_Code_Legal"."name", "Global_Code_primIn"."name", "Global_Code_RS"."name", "Global_Code_LA"."name", "Global_Code_Stud"."name", "Global_Code_Educ"."name", "Global_Code_Milt"."name", "Global_Code_Occu"."name", "Global_Code_MStatus"."name", "Global_Code_Race"."name", "Global_Code_Sal"."name", "Global_Code_Sex"."name", "Global_Code_FS"."name", "Custom_Dropdowns_Eth"."field_description", "Custom_Dropdowns_Phy"."field_description", "Chemical_Dependency"."drug"
FROM (((((((((((((((((((("Patient" "Patient" LEFT OUTER JOIN "Intake_Med_Hx" "Intake_Med_Hx" ON ("Patient"."patient_id"="Intake_Med_Hx"."patient_id") AND ("Patient"."episode_id"="Intake_Med_Hx"."episode_id")) LEFT OUTER JOIN "Patient_Legal" "Patient_Legal" ON ("Patient"."patient_id"="Patient_Legal"."patient_id") AND ("Patient"."episode_id"="Patient_Legal"."episode_id")) INNER JOIN "Patient_Risk_Assessment" "Patient_Risk_Assessment" ON ("Patient"."patient_id"="Patient_Risk_Assessment"."patient_id") AND ("Patient"."episode_id"="Patient_Risk_Assessment"."episode_id")) LEFT OUTER JOIN "Patient_Custom" "Patient_Custom" ON ("Patient"."patient_id"="Patient_Custom"."patient_id") AND ("Patient"."episode_id"="Patient_Custom"."episode_id")) LEFT OUTER JOIN "Global_Code" "Global_Code_Sex" ON "Patient"."sex"="Global_Code_Sex"."code") LEFT OUTER JOIN "Global_Code" "Global_Code_Stud" ON "Patient"."student_status"="Global_Code_Stud"."code") LEFT OUTER JOIN "Global_Code" "Global_Code_Race" ON "Patient"."race"="Global_Code_Race"."code") LEFT OUTER JOIN "Global_Code" "Global_Code_MStatus" ON "Patient"."marital_status"="Global_Code_MStatus"."code") LEFT OUTER JOIN "Global_Code" "Global_Code_Sal" ON "Patient"."salary"="Global_Code_Sal"."code") LEFT OUTER JOIN "Global_Code" "Global_Code_Occu" ON "Patient"."occ_status"="Global_Code_Occu"."code") LEFT OUTER JOIN "Global_Code" "Global_Code_Educ" ON "Patient"."ed_level"="Global_Code_Educ"."code") LEFT OUTER JOIN "Global_Code" "Global_Code_Milt" ON "Patient"."military_status"="Global_Code_Milt"."code") LEFT OUTER JOIN "Global_Code" "Global_Code_RS" ON "Patient"."referral_source"="Global_Code_RS"."code") LEFT OUTER JOIN "Global_Code" "Global_Code_LA" ON "Patient"."living_arrangement_1"="Global_Code_LA"."code") LEFT OUTER JOIN "Psychiatric_History" "Psychiatric_History" ON ("Patient"."patient_id"="Psychiatric_History"."patient_id") AND ("Patient"."episode_id"="Psychiatric_History"."episode_id")) LEFT OUTER JOIN "Global_Code" "Global_Code_FS" ON "Patient"."fin_status"="Global_Code_FS"."code") LEFT OUTER JOIN "Global_Code" "Global_Code_Legal" ON "Patient_Legal"."crt_disp"="Global_Code_Legal"."code") LEFT OUTER JOIN "Chemical_Dependency" "Chemical_Dependency" ON "Patient_Risk_Assessment"."session_no"="Chemical_Dependency"."session_no") LEFT OUTER JOIN "Global_Code" "Global_Code_primIn" ON "Patient_Custom"."pincosrc"="Global_Code_primIn"."code") LEFT OUTER JOIN "Custom_Dropdowns" "Custom_Dropdowns_Eth" ON "Patient_Custom"."ethnicity"="Custom_Dropdowns_Eth"."field_value") LEFT OUTER JOIN "Custom_Dropdowns" "Custom_Dropdowns_Phy" ON "Patient_Custom"."physical"="Custom_Dropdowns_Phy"."field_value"
WHERE "Global_Code_Sex"."category"='SEX' AND "Global_Code_Occu"."category"='OS' AND "Global_Code_Stud"."category"='SS' AND "Global_Code_Educ"."category"='ED' AND "Global_Code_LA"."category"='LA' AND "Global_Code_RS"."category"='RS' AND "Global_Code_Legal"."category"='CRTDISP' AND "Global_Code_primIn"."category"='PINCOSRC' AND "Global_Code_Race"."category"='R' AND "Global_Code_MStatus"."category"='MS' AND "Global_Code_Sal"."category"='SA'
ORDER BY "Patient"."patient_id"
How can I write this to show all the data even if one of the fields are NULL. For example if Patient education is blank but everything else is there The patient's data is not pulling at all.
Thanks in advance.