Unanswered: querying license that has been expired 4 200 days
Ok, I have a date_expired field of the date that a license will expire. I would like to write a query for license's that have been expired for 200 plus days.
I don't know what it is but I'm missing and not getting the info that I want.
SELECT a.LNAME, a.FNAME, B.ID AS LIC_CONTACT_LINK_ID, C.LIC_NUMBER, C.LIC_TYPEDEF_ID, C.DATE_CREATED,
E.DATE_EXPIRES, D.LIC_STATUS, D.WORK_STATUS
--, DATEPART(DAY, getdate()) - DATEPART(DAY, E.DATE_EXPIRES) AS NO_OF_DAYS_LEFT
FROM C_CONTACT_PEOPLE A,
WHERE a.ID = B.C_CONTACT_PEOPLE_ID
AND B.ID = C.PRIMARY_CONTACT_LINK_ID
AND C.ID = E.LIC_HOLDERINFO_ID
AND C.STATUS_ID = D.ID
and c.lic_typedef_id = 4
AND C.STATUS_ID IN (SELECT distinct id
WHERE (License_Status <> 'PENDING'))
--AND E.DATE_EXPIRES >= DATEDIFF (DAY, 200, getdate())
order by LNAME