Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- p.Last_Name
- ,p.First_Name
- ,p.Middle_Initial
- ,i.Document
- ,i.Expiration_date
- ,i.Updated_Date
- ,i.IssueDate
- ,i.Historical
- ,i.Comments
- ,f.Current_status
- ,i.State as DocumentState
- from dbo.PersonDoc_ID_Numbers i
- inner join "MSOW"."dbo"."People" p on p.person_id = i.person_id
- left join person_facilities f on p.person_id = f.person_id
- where
- (Document like '%limited%' and i.State like '%NY%' and ((i.Expiration_date > getdate()) or (i.Expiration_date is null))) or
- (Document like '%NY%' and i.State like '%NY%' and ((i.Expiration_date > getdate()) or (i.Expiration_date is null)))
- and f.current_status in ('Active')
- and i.Historical != 1
- order by p.Last_Name
- Last_Name First_Name Middle_Initial person_id Document Expiration_date Updated_Date
- GG FF L. 123 Limited Permit 2019-09-23 2018-10-04 456
- GG FF L. 123 NY State License NULL 2018-11-13
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement