M
MarieG
Hi,
I'm linking 3 tables.. when I run the query, the info for patient visit id,
ticket number, Date of Service, Description, vbalance, logged date, and
logged by are a wrong. There should only be 4 rows of info for the
patientvisit id number 30865, but it returns many more than that, of which
most should be associated with different patientvisidid numbers.. ideas?
Thanks so much!!
SELECT [dbo_vBilling_Visits-TMC002-OGA].Company,
[dbo_vBilling_Visits-TMC002-OGA].VisitOwner,
[dbo_vBilling_Visits-TMC002-OGA].Patient,
[dbo_PatientCorrespondence-TMC002-OGA].PatientProfileId,
[dbo_PatientCorrespondence-TMC002-OGA].PatientVisitId,
[dbo_vBilling_Visits-TMC002-OGA].TicketNumber,
[dbo_vBilling_Visits-TMC002-OGA].DateOfService,
[dbo_PatientCorrespondence-TMC002-OGA].Source,
[dbo_PatientCorrespondence-TMC002-OGA].UserId,
[dbo_PatientCorrespondence-TMC002-OGA].Description,
[dbo_PatientCorrespondence-TMC002-OGA].DescriptionLong,
[dbo_PatientCorrespondence-TMC002-OGA].NextContactDate,
[dbo_vBilling_Visits-TMC002-OGA].vBalance,
[dbo_PatientInfoLog-TMC002-OGA].Created AS [Logged Date],
[dbo_PatientInfoLog-TMC002-OGA].CreatedBy AS [Logged by]
FROM [Date Pulled], [dbo_vBilling_Visits-TMC002-OGA] INNER JOIN
([dbo_PatientCorrespondence-TMC002-OGA] INNER JOIN
[dbo_PatientInfoLog-TMC002-OGA] ON
[dbo_PatientCorrespondence-TMC002-OGA].PatientVisitId =
[dbo_PatientInfoLog-TMC002-OGA].PatientVisitId) ON
([dbo_vBilling_Visits-TMC002-OGA].PatientVisitID =
[dbo_PatientInfoLog-TMC002-OGA].PatientVisitId) AND
([dbo_vBilling_Visits-TMC002-OGA].PatientVisitID =
[dbo_PatientCorrespondence-TMC002-OGA].PatientVisitId)
WHERE ((([dbo_PatientCorrespondence-TMC002-OGA].PatientProfileId)=24008) AND
(([dbo_PatientInfoLog-TMC002-OGA].Created) Between [FROM DATE] And [TO DATE])
AND (([dbo_PatientInfoLog-TMC002-OGA].CreatedBy) Like "TMC-ROSE*" Or
([dbo_PatientInfoLog-TMC002-OGA].CreatedBy) Like "TMC-KRISTINA*" Or
([dbo_PatientInfoLog-TMC002-OGA].CreatedBy) Like "TMC-SANDRA*"));
I'm linking 3 tables.. when I run the query, the info for patient visit id,
ticket number, Date of Service, Description, vbalance, logged date, and
logged by are a wrong. There should only be 4 rows of info for the
patientvisit id number 30865, but it returns many more than that, of which
most should be associated with different patientvisidid numbers.. ideas?
Thanks so much!!
SELECT [dbo_vBilling_Visits-TMC002-OGA].Company,
[dbo_vBilling_Visits-TMC002-OGA].VisitOwner,
[dbo_vBilling_Visits-TMC002-OGA].Patient,
[dbo_PatientCorrespondence-TMC002-OGA].PatientProfileId,
[dbo_PatientCorrespondence-TMC002-OGA].PatientVisitId,
[dbo_vBilling_Visits-TMC002-OGA].TicketNumber,
[dbo_vBilling_Visits-TMC002-OGA].DateOfService,
[dbo_PatientCorrespondence-TMC002-OGA].Source,
[dbo_PatientCorrespondence-TMC002-OGA].UserId,
[dbo_PatientCorrespondence-TMC002-OGA].Description,
[dbo_PatientCorrespondence-TMC002-OGA].DescriptionLong,
[dbo_PatientCorrespondence-TMC002-OGA].NextContactDate,
[dbo_vBilling_Visits-TMC002-OGA].vBalance,
[dbo_PatientInfoLog-TMC002-OGA].Created AS [Logged Date],
[dbo_PatientInfoLog-TMC002-OGA].CreatedBy AS [Logged by]
FROM [Date Pulled], [dbo_vBilling_Visits-TMC002-OGA] INNER JOIN
([dbo_PatientCorrespondence-TMC002-OGA] INNER JOIN
[dbo_PatientInfoLog-TMC002-OGA] ON
[dbo_PatientCorrespondence-TMC002-OGA].PatientVisitId =
[dbo_PatientInfoLog-TMC002-OGA].PatientVisitId) ON
([dbo_vBilling_Visits-TMC002-OGA].PatientVisitID =
[dbo_PatientInfoLog-TMC002-OGA].PatientVisitId) AND
([dbo_vBilling_Visits-TMC002-OGA].PatientVisitID =
[dbo_PatientCorrespondence-TMC002-OGA].PatientVisitId)
WHERE ((([dbo_PatientCorrespondence-TMC002-OGA].PatientProfileId)=24008) AND
(([dbo_PatientInfoLog-TMC002-OGA].Created) Between [FROM DATE] And [TO DATE])
AND (([dbo_PatientInfoLog-TMC002-OGA].CreatedBy) Like "TMC-ROSE*" Or
([dbo_PatientInfoLog-TMC002-OGA].CreatedBy) Like "TMC-KRISTINA*" Or
([dbo_PatientInfoLog-TMC002-OGA].CreatedBy) Like "TMC-SANDRA*"));