Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. p.Last_Name
  2. ,p.First_Name
  3. ,p.Middle_Initial
  4. ,i.Document
  5. ,i.Expiration_date
  6. ,i.Updated_Date
  7. ,i.IssueDate
  8. ,i.Historical
  9. ,i.Comments
  10. ,f.Current_status
  11. ,i.State as DocumentState
  12.  
  13. from dbo.PersonDoc_ID_Numbers i
  14.  
  15. inner join "DB"."dbo"."People" p on p.person_id = i.person_id
  16. left join person_facilities f on p.person_id = f.person_id
  17.  
  18. where
  19. (Document like '%limited%' and i.State like '%NY%' and ((i.Expiration_date > getdate()) or (i.Expiration_date is null))) or
  20. (Document like '%NY%' and i.State like '%NY%' and ((i.Expiration_date > getdate()) or (i.Expiration_date is null)))
  21. and f.current_status in ('Active')
  22. and i.Historical != 1
  23.  
  24. order by p.Last_Name
  25.  
  26. Last_Name First_Name Middle_Initial person_id Document Expiration_date Updated_Date
  27. GG FF L. 123 Limited Permit 2019-09-23 2018-10-04 456
  28. GG FF L. 123 NY State License NULL 2018-11-13
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement