SELECT TOP 1 * FROM PeisPatient WHERE Org_Name IS NOT NULL AND DateFinalExamed>'2012-01-01' AND DateFinalExamed<'2012-12-31'
--猜测一下吧 select b.* from PeisPatient as a inner join PeisPatientExamItem as b on a.SevereDegree=b.SevereDegree where a.Org_Name is not null and a.DateFinalExamed>'2012-01-01' and a.DateFinalExamed<'2012-12-31' and a.DateFinalExamed=(select max(DateFinalExamed) from PeisPatient where Org_Name =a.Org_Name)
*
FROM
PeisPatient
WHERE
Org_Name IS NOT NULL AND DateFinalExamed>'2012-01-01' AND DateFinalExamed<'2012-12-31'
--猜测一下吧
select
b.*
from
PeisPatient as a
inner join
PeisPatientExamItem as b
on
a.SevereDegree=b.SevereDegree
where
a.Org_Name is not null
and
a.DateFinalExamed>'2012-01-01' and a.DateFinalExamed<'2012-12-31'
and
a.DateFinalExamed=(select max(DateFinalExamed) from PeisPatient where Org_Name =a.Org_Name)
我想达到查询一个时间段内有那些单位的那些人做了内科这个项目以下为表结构和字段
PeisPatient表结构PeisPatientExamItem表结构