Joined: 21 Jan 2011
Online Status: Offline
Posts: 107
Topic: Union statement help Posted: 23 Jul 2014 at 3:40pm
Hello I wrote my first union statement however I need to incorporate another part into the sql and I am not sure how to do about doing so.
Below is my union statement
SELECT
PAF.partnership_date AS ASSMT_DTE,
PAF.PATID AS PATIENT_ID,
PAF.assessment_status_value AS ASSMT_STATUS,
PAF.PAFuniqueid as ID
FROM
SYSTEM.mhsa_part_assess_form PAF
UNION
SELECT
KET.date_completed,
KET.PATID,
KET.assessment_status_value,
KET.KETuniqueid
FROM
SYSTEM.mhsa_key_event_tracking KET
UNION
SELECT
QAF.date_completed,
QAF.PATID,
QAF.assessment_status_value,
QAF.QASuniqueid
FROM
SYSTEM.mhsa_quarterly_assessment QAF
And the part I need to add to that statement is below
SELECT
TPD.program_value,
TPD.program_X_full_svc_p_p_id
FROM
SYSTEM.table_program_definition TPD
WHERE
TPD.program_X_full_svc_p_p_id IS NOT NULL
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum