本文介绍了我如何获得最短约会的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获得访问的最短日期。我试图第一次访问这个人。这是我的整个人列表。

这是我的查询:

 声明  @ dateDate   as   DateTime  
设置 @ dateDate = SYSDATETIME()

select distinct a.PatientName,
a.PatientSSN,
CONVERT 日期 @ dateDate AS FIRSTVISIT
来自 SPatient.SPatient a
JOIN OUTPAT.VISIT AS D
ON A.PATIENTSID = D.PATIENTSID
加入 Dim.Location 作为 c
D. LocationSID = c.LocationSID
其中 c.locationname 喜欢 ' %wi - %'
c.LocationName 喜欢 ' %wi-PHONE%'
c.LocationName 喜欢 ' %non va%'
c.LocationName 喜欢 ' %ds%'
group by a.patientname,a.patientssn
order by a.patientname,a.patientssn
解决方案

How do I get the minimum date for a visit. I am trying to get the first time the person had a visit. This is for my entire person listing.
Here is my query:

Declare @dateDate as DateTime
Set @dateDate = SYSDATETIME()

select distinct a.PatientName,
       a.PatientSSN,
       CONVERT(Date, @dateDate) AS FIRSTVISIT
from    SPatient.SPatient as a
    JOIN OUTPAT.VISIT AS D
        ON A.PATIENTSID=D.PATIENTSID
    join Dim.Location as c
        on D.LocationSID=c.LocationSID
where c.locationname like '%wi-%'
      and c.LocationName not like '%wi-PHONE%'
      and c.LocationName not like '%non va%'
      and c.LocationName not like '%ds%'
group by a.patientname, a.patientssn
order by a.patientname, a.patientssn
解决方案


这篇关于我如何获得最短约会的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 04:44