troubleshooting Question

Change Select Statement

Avatar of pflugg
pflugg asked on
Crystal Reports
2 Comments1 Solution301 ViewsLast Modified:
I have a report that uses SQL1, listed below. I want to change it to use SQL2, which has a different select statement. How can I make that happen.

Database | Show SQL Query won't allow me to change the select statement. Is there another way?

SQL1:
SELECT
    "PATIENT_DEMO"."LAST_NAME", "PATIENT_DEMO"."FIRST_NAME", "PATIENT_DEMO"."MIDDLE_NAME", "PATIENT_DEMO"."L_NAME_SUFFIX", "PATIENT_DEMO"."SEX_ID", "PATIENT_DEMO"."HOME_ADD_1", "PATIENT_DEMO"."HOME_ADD_2", "PATIENT_DEMO"."HOME_CITY", "PATIENT_DEMO"."HOME_STATE", "PATIENT_DEMO"."POSTAL_CODE", "ACTIONS"."PAT_ID", "ACTIONS"."ACT_ID", "PAT_REF_CARE"."PAT_ID", "CARE_PROVIDERS"."CARE_PROVIDER_TYPE", "CARE_PROVIDERS"."LAST_NAME", "CARE_PROVIDERS"."MIDDLE_NAME", "CARE_PROVIDERS"."FIRST_NAME", "CARE_PROVIDERS"."SUFFIX"
FROM
    "OTTR"."PATIENT_DEMO" "PATIENT_DEMO",
    "OTTR"."ACTIONS" "ACTIONS",
    "OTTR"."PAT_REF_CARE" "PAT_REF_CARE",
    "OTTR"."CARE_PROVIDERS" "CARE_PROVIDERS"
WHERE
    "PATIENT_DEMO"."PAT_ID" = "ACTIONS"."PAT_ID"(+) AND
    "PATIENT_DEMO"."PAT_ID" = "PAT_REF_CARE"."PAT_ID"(+) AND
    "PAT_REF_CARE"."CARE_ID" = "CARE_PROVIDERS"."CARE_ID"(+) AND
    "PAT_REF_CARE"."PAT_ID" >= 132. AND
    "PAT_REF_CARE"."PAT_ID" <= 142. AND
    ("ACTIONS"."ACT_ID" = 10061. OR
    "ACTIONS"."ACT_ID" = 10023.) AND
    "CARE_PROVIDERS"."CARE_PROVIDER_TYPE" = 432.

SQL2
SELECT DISTINCT

    "PATIENT_DEMO"."LAST_NAME", "PATIENT_DEMO"."FIRST_NAME", "PATIENT_DEMO"."MIDDLE_NAME", "PATIENT_DEMO"."L_NAME_SUFFIX", "PATIENT_DEMO"."SEX_ID", "PATIENT_DEMO"."HOME_ADD_1", "PATIENT_DEMO"."HOME_ADD_2", "PATIENT_DEMO"."HOME_CITY", "PATIENT_DEMO"."HOME_STATE", "PATIENT_DEMO"."POSTAL_CODE", "CARE_PROVIDERS"."CARE_PROVIDER_TYPE", "CARE_PROVIDERS"."LAST_NAME", "CARE_PROVIDERS"."MIDDLE_NAME", "CARE_PROVIDERS"."FIRST_NAME", "CARE_PROVIDERS"."SUFFIX"

FROM

    "OTTR"."PATIENT_DEMO" "PATIENT_DEMO",

    "OTTR"."ACTIONS" "ACTIONS",

    "OTTR"."PAT_REF_CARE" "PAT_REF_CARE",

    "OTTR"."CARE_PROVIDERS" "CARE_PROVIDERS"

WHERE

    "PATIENT_DEMO"."PAT_ID" = "ACTIONS"."PAT_ID"(+) AND

    "PATIENT_DEMO"."PAT_ID" = "PAT_REF_CARE"."PAT_ID"(+) AND

    "PAT_REF_CARE"."CARE_ID" = "CARE_PROVIDERS"."CARE_ID"(+) AND

    "PAT_REF_CARE"."PAT_ID" >= 132. AND

    "PAT_REF_CARE"."PAT_ID" <= 142. AND

    ("ACTIONS"."ACT_ID" = 10061. OR

    "ACTIONS"."ACT_ID" = 10023.) AND

    "CARE_PROVIDERS"."CARE_PROVIDER_TYPE" = 432.
ASKER CERTIFIED SOLUTION
DRRYAN3

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros