SELECT
  dbo.ALL_PATIENTS.PATNT_KEY as PATNT_KEY,
  Table__1308.IDENT_ID_INT as "MRN (UF)",
  Table__1117.IDENT_ID_INT as "MRN (Jax)",
  Table__1308.IDENT_ID as "MRN (UF)(char)",
  Table__1311.IDENT_ID_int as "MRN (Vista)",
  Table__1312.IDENT_ID_int as "MRN (Rehab)",
  Table__2699.IDENT_ID_INT as "MRN (CFH Leesburg)",
  Table__2700.IDENT_ID_INT as "MRN (CFH Villages)"
FROM
  dbo.ALL_PATIENTS RIGHT OUTER JOIN dbo.ALL_PATIENT_SNAPSHOTS  ALL_PT_SNAPSHOTS_ENCOUNTER ON (ALL_PT_SNAPSHOTS_ENCOUNTER.PATNT_KEY=dbo.ALL_PATIENTS.PATNT_KEY)
   LEFT OUTER JOIN ( 
  SELECT * 
FROM 
   dbo.ALL_PATIENT_IDENTITIES 
WHERE
   dbo.ALL_PATIENT_IDENTITIES.LOOKUP_IND = 'Y'
AND
   dbo.ALL_PATIENT_IDENTITIES.IDENT_ID_TYPE = 110
  )  Table__1117 ON (Table__1117.PATNT_KEY=ALL_PT_SNAPSHOTS_ENCOUNTER.PATNT_KEY)
   LEFT OUTER JOIN ( 
  SELECT * 
FROM 
   dbo.ALL_PATIENT_IDENTITIES 
WHERE
   dbo.ALL_PATIENT_IDENTITIES.LOOKUP_IND = 'Y'
AND
   dbo.ALL_PATIENT_IDENTITIES.IDENT_ID_TYPE = 101
  )  Table__1308 ON (ALL_PT_SNAPSHOTS_ENCOUNTER.PATNT_KEY=Table__1308.PATNT_KEY)
   LEFT OUTER JOIN ( 
  SELECT * 
FROM 
   dbo.ALL_PATIENT_IDENTITIES 
WHERE
   dbo.ALL_PATIENT_IDENTITIES.LOOKUP_IND = 'Y'
AND
   dbo.ALL_PATIENT_IDENTITIES.IDENT_ID_TYPE = 108

  )  Table__1311 ON (Table__1311.PATNT_KEY=ALL_PT_SNAPSHOTS_ENCOUNTER.PATNT_KEY)
   LEFT OUTER JOIN ( 
  SELECT * 
FROM 
   dbo.ALL_PATIENT_IDENTITIES 
WHERE
   dbo.ALL_PATIENT_IDENTITIES.LOOKUP_IND = 'Y'
AND
   dbo.ALL_PATIENT_IDENTITIES.IDENT_ID_TYPE = 106
  )  Table__1312 ON (Table__1312.PATNT_KEY=ALL_PT_SNAPSHOTS_ENCOUNTER.PATNT_KEY)
   LEFT OUTER JOIN ( 
  SELECT * 
FROM 
   dbo.ALL_PATIENT_IDENTITIES 
WHERE
   dbo.ALL_PATIENT_IDENTITIES.LOOKUP_IND = 'Y'
AND
   dbo.ALL_PATIENT_IDENTITIES.IDENT_ID_TYPE = 201
  )  Table__2699 ON (ALL_PT_SNAPSHOTS_ENCOUNTER.PATNT_KEY=Table__2699.PATNT_KEY)
   LEFT OUTER JOIN ( 
  SELECT * 
FROM 
   dbo.ALL_PATIENT_IDENTITIES 
WHERE
   dbo.ALL_PATIENT_IDENTITIES.LOOKUP_IND = 'Y'
AND
   dbo.ALL_PATIENT_IDENTITIES.IDENT_ID_TYPE = 202
  )  Table__2700 ON (ALL_PT_SNAPSHOTS_ENCOUNTER.PATNT_KEY=Table__2700.PATNT_KEY)
  
WHERE
  (
   dbo.ALL_PATIENTS.PATNT_KEY  IN  ( 0123456789, 1234567890  )
   AND
   ( dbo.ALL_PATIENTS.TEST_IND='N'  )
  )
/* User Running = @Variable('BOUSER') ; Document = @Variable('DOCNAME'); Query = @Variable('DPNAME') (@Variable('DPTYPE')) */