|
Question : Query asking for an Expr1 as a PArameter
|
|
Hi Guys this is the SQl query
SELECT PatientMaster.PatientID, PatientMaster.PatientCode, DiagnosisDetails.GISTDiagnosisDate,
Max(IIf(maxdate([PatientMaster].[LastUpdateDate],[PatientMaster].[LastUpdateDate],[TimeLine].[Start Date])=#1/1/1000#,"",maxdate([PatientMaster].[LastUpdateDate],[PatientMaster].[LastUpdateDate],[TimeLine].[Start Date]))) AS LastContactEvent
,
DateDiff("d",[DiagnosisDetails].[GISTDiagnosisDate],[LastContactEvent]) AS OPSND
FROM (PatientMaster LEFT JOIN TimeLine ON PatientMaster.PatientID = TimeLine.Patient) INNER JOIN DiagnosisDetails ON PatientMaster.PatientID = DiagnosisDetails.PatientID GROUP BY PatientMaster.PatientID, PatientMaster.PatientCode, DiagnosisDetails.GISTDiagnosisDate, DateDiff("d",[DiagnosisDetails].[GISTDiagnosisDate],[LastContactEvent]), PatientMaster.Deceased HAVING (((PatientMaster.Deceased)=No)) ORDER BY PatientMaster.PatientID, Max(IIf(maxdate([PatientMaster].[LastUpdateDate],[PatientMaster].[LastUpdateDate],[TimeLine].[Start Date])=#1/1/1000#,"",maxdate([PatientMaster].[LastUpdateDate],[PatientMaster].[LastUpdateDate],[TimeLine].[Start Date])));
When i run this query is asking me for [LastContactEvent] as a Parameter, i hit enter and runs fine, i do not know why i am using [LastContactEvent] as the max of 3 days i call a function that i create and return the mas of 3 dates. in OPSND i use [LastContactEvent] to get the difference in days between [lastcontactevent] and another datefield
Any idea
best regards
|
|
Answer : Query asking for an Expr1 as a PArameter
|
|
your query needs to read:
SELECT PatientMaster.PatientID, PatientMaster.PatientCode, DiagnosisDetails.GISTDiagnosisDate, Max(IIf(maxdate([PatientMaster].[LastUpdateDate],[PatientMaster].[LastUpdateDate],[TimeLine].[Start Date])=#1/1/1000#,"",maxdate([PatientMaster].[LastUpdateDate],[PatientMaster].[LastUpdateDate],[TimeLine].[Start Date]))) AS LastContactEvent, DateDiff("d",[DiagnosisDetails].[GISTDiagnosisDate],Max(IIf(maxdate([PatientMaster].[LastUpdateDate],[PatientMaster].[LastUpdateDate],[TimeLine].[Start Date])=#1/1/1000#,"",maxdate([PatientMaster].[LastUpdateDate],[PatientMaster].[LastUpdateDate],[TimeLine].[Start Date]))) ) AS OPSND FROM (PatientMaster LEFT JOIN TimeLine ON PatientMaster.PatientID = TimeLine.Patient) INNER JOIN DiagnosisDetails ON PatientMaster.PatientID = DiagnosisDetails.PatientID GROUP BY PatientMaster.PatientID, PatientMaster.PatientCode, DiagnosisDetails.GISTDiagnosisDate, DateDiff("d",[DiagnosisDetails].[GISTDiagnosisDate],[LastContactEvent]), PatientMaster.Deceased HAVING (((PatientMaster.Deceased)=No)) ORDER BY PatientMaster.PatientID, Max(IIf(maxdate([PatientMaster].[LastUpdateDate],[PatientMaster].[LastUpdateDate],[TimeLine].[Start Date])=#1/1/1000#,"",maxdate([PatientMaster].[LastUpdateDate],[PatientMaster].[LastUpdateDate],[TimeLine].[Start Date])));
|
|
|
|