SELECTDISTINCT v_ClientAdvertisementStatus.AdvertisementID, v_Advertisement.AdvertisementName, dbo.v_Package.PkgSourcePath

FROM dbo.v_Package INNERJOIN

dbo.v_Advertisement ON dbo.v_Package.PackageID = dbo.v_Advertisement.PackageID RIGHTOUTERJOIN

dbo.v_ClientAdvertisementStatus ON v_Advertisement.AdvertisementID = v_ClientAdvertisementStatus.AdvertisementID

WHERE (v_ClientAdvertisementStatus.LastStateName =‘succeeded’)AND(v_ClientAdvertisementStatus.LastStatusTime >DATEADD(day, 90,GETDATE()))

ORDERBY dbo.v_Advertisement.AdvertisementName