-
Hola buen dia,
necesito ayuda con este query en SQL donde tengo que hacer que las dos fechas que estan en bold "CAMBIEN AUTOMATICAMENTE cada mes y cada año" en el futuro. alguna idea?
SELECT a.PatientId,a.DataSourceKey
,c.RosterMonth
,a.AppointmentDate
,a.VisitType
,a.NewPatient
,a.ResourceProviderNPI
,a.ResourceProviderName
,a.OriginalPatientName
,a.IsProviderVisit
,a.VisitStatus
,b.MBI
,c.OriginalLOB
,c.OriginalPayer
,f.Grouping
,f.PracticeShortName
,a.isTelehealth
FROM [cube].FactVisits a
LEFT JOIN [cube].Patient b
ON a.PatientId=b.PatientId
LEFT JOIN [cube]. FactPayersEnrollmentRoster c
ON a.PatientId=c.PatientID
LEFT JOIN [cube].vAttributedProvider e
ON c.AttributedProviderID = e.AttributedProviderID
LEFT JOIN [cube].vLocationAttributed f
on e.PrimaryLocationId = f.LocationId
WHERE AppointmentDate between '2023-01-01' AND '2023-12-31'--DOS YTD --
AND VisitStatus in ('checked-out, 'pending')
AND IsProviderVisit like 'Y'
AND c.RosterMonth like '2023-08-01'--Change to current roster month --
AND c.OriginalLOB = 'commercial exchange'
GROUP BY a.PatientId,a.DataSourceKey,c.RosterMonth, a.AppointmentDate,a.VisitType,a.NewPatient,a.ResourceProviderNPI,a.ResourceProviderName,a.OriginalPatientName,a.IsProviderVisit,a.VisitStatus
, b.MBI,c.OriginalLOB,c.OriginalPayer,f.Grouping,f.PracticeShortName, a.isTelehealth
- El debate ‘SQL Query formula fecha automatica?’ está cerrado y no admite más respuestas.