>>SELECT DISTINCT Sitedata.id, Sitedata.site_name, Sitedata.r1,; >> Sitedata.city, Sitedata.status,; >> reports.recvdate, reports.respdate, reports.rptname; >> FROM ; >> events!Sitedata; >> LEFT OUTER JOIN events!reports ; >> ON sitedata.id = reports.id; >> WHERE reports.respdate = {}; >> AND reports.rptname != NULL; *Should make sure there is a report listed >> AND (Sitedata.status = "O" OR Sitedata.status = "M"); *Indicates the case is open or monitoring >> AND DATE() > reports.recvdate + 30 ; *Indicates it has been more than 30 days since the received date >> AND reports.recvdate = (select max (recvdate) from Reports where SiteData.ID = Reports.ID) ; *grabs only the last report >> AND reports.recvdate != {}; *Makes sure there is a received date >> ORDER BY Sitedata.id; >> INTO CURSOR reviewer >>WITH thisform >>.WindowState = 2 >>ENDWITH >>BROWSE >>thisform.Visible = .F. >>WITH thisform >>.WindowState = 0 >>ENDWITH >>DO FORM frmexport.scx TO m.exportcheck >>IF m.exportcheck = "a" >> EXPORT TO C:\Temp\NoReviewer.xls TYPE xls >>ENDIF >>thisform.Visible = .T. >>>
>SELECT DISTINCT Sitedata.id, Sitedata.site_name, Sitedata.r1,; > Sitedata.city, Sitedata.status,; > reports.recvdate,; > reports.respdate,; > reports.rptname; >FROM events!Sitedata; >INNER JOIN events!reports ON sitedata.id = reports.id; >WHERE reports.respdate = {}; > AND (Sitedata.status = "O" OR Sitedata.status = "M") ; &&Indicates the case is open or monitoring > AND reports.recvdate < (DATE() - 30) ; &&Indicates it has been more than 30 days since the received date > AND reports.recvdate = (select max (recvdate) from Reports where SiteData.ID = Reports.ID) ; &&grabs only the last report > AND reports.recvdate != {} ; &&Makes sure there is a received date >ORDER BY Sitedata.id; >INTO CURSOR reviewer >