dugjohnson
Programmer
I need to do a mess of cross tabs based on whether a patient has had services in a given period. And while I am at it, I am counting their family members in the crosstab too. By linking the exam table to the patient table, then linking the patient table to itself as an alias via the family number (patient ID and family number are different fields) I get the records. Wahoo. But if I have multiple exams for a patient in the period, my count is multiplied by that amount. What I really want to count on is the distinct records in the final patient/family member table, but I can't figure out how to make just that table distinct.
The SQL currently looks like
SELECT
PATIENT."SEX", PATIENT."ZIP", PATIENT."FIN_TYPE", PATIENT."ZZETHNICTY", PATIENT."ZZHANDICAP", PATIENT."ZZLANGUAGE", PATIENT."ZZRELGION", PATIENT."ZZINCOME", PATIENT."ZZINSTYPE",
EXAM."EXAMDATE"
FROM
"PATIENT" PATIENT,
"PATIENT" Patient2,
"EXAM" EXAM
WHERE
PATIENT."BILLNUM" = Patient2."BILLNUM" AND
Patient2."PAT_ID" = EXAM."PAT_ID" AND
EXAM."EXAMDATE" >= '20030701' AND
EXAM."EXAMDATE" <= '20030731'
Patient2 is the linking patient table, Patient is the one I am counting.
Any help would be appreciated.
Doug
The SQL currently looks like
SELECT
PATIENT."SEX", PATIENT."ZIP", PATIENT."FIN_TYPE", PATIENT."ZZETHNICTY", PATIENT."ZZHANDICAP", PATIENT."ZZLANGUAGE", PATIENT."ZZRELGION", PATIENT."ZZINCOME", PATIENT."ZZINSTYPE",
EXAM."EXAMDATE"
FROM
"PATIENT" PATIENT,
"PATIENT" Patient2,
"EXAM" EXAM
WHERE
PATIENT."BILLNUM" = Patient2."BILLNUM" AND
Patient2."PAT_ID" = EXAM."PAT_ID" AND
EXAM."EXAMDATE" >= '20030701' AND
EXAM."EXAMDATE" <= '20030731'
Patient2 is the linking patient table, Patient is the one I am counting.
Any help would be appreciated.
Doug