Created
April 21, 2009 16:43
-
-
Save ebot/99233 to your computer and use it in GitHub Desktop.
Nag Sample Deficiency Report Query
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Select docs.DocId, DocTypeName, DocTypeDesc,DocStatus, DefStatusName, OwnerTypeName, | |
EnrolleeName, docs.CreateDateTime, ModifyDateTime, DocDateTime | |
From Documents as docs | |
Inner Join DocsOwners as do on | |
docs.DocId = do.DocId | |
Inner Join Encounters as enc on | |
do.OwnerId = enc.EncntrOwnerId | |
Inner Join DocTypes as dt on | |
docs.DocType = dt.DocType | |
left outer join deficiencies as def on | |
docs.DocId = def.DocId | |
left outer join DeficiencyStatus as ds on | |
def.DefStatus = ds.DefStatus | |
Left Outer Join Supplements as sup on | |
docs.DocId = sup.DocId | |
Left Join Owners as own on | |
def.RespPartyOwnerId = own.OwnerId | |
Left Join OwnerTypes as ot on | |
own.OwnerType =ot.OwnerType | |
Left Join Users on | |
def.RespPartyOwnerId = users.UserOwnerId | |
Left Join Employees as emp on | |
users.EmpOwnerId = emp.EmpOwnerId | |
Left Join Enrollees as enr on | |
emp.EnrolleeOwnerId = enr.EnrolleeOwnerId | |
Where docs.CreateDateTime > '4/20/2009' | |
And docs.CreateDateTime < '4/22/2009' | |
And EncounterNo in ('989898','8908900') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment