Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Hi,I have the above script and basically I only want training events returned that ocurred 8 weeks ago. The script below is returning all the training events within the last 60 days (approx 8 weeks!) regardless of when...Can anyone help? Ive tried using the DATEADD function but no joy.Thanksselect T.COURSE_REF, T.COURSENAME, T.STARTTIME, E.FORENAME, E.SURNAME, MGR.FORENAME, MGR.E_MAIL_ID as _MAILTOfrom TRAINREC T, EMPLOYEE E, EMPLOYEE MGRwhere T.EMPLOY_REF= E.EMPLOY_REFand T.STATUS= 'COMPLETED'and E.LOCATION = 'HQ'and E.LEAVER NOT LIKE '1'and E.MGR_REF *= MGR.EMPLOY_REFand T.COURSE_REF = 'TTMHS03'and (T.FINISHTIME between floor(convert(float, getdate()-60)) and floor(convert(float, getdate())))
khtan
In (Som, Ni, Yak)
17689 Posts
Posted - 2009-06-10 : 10:15:54
change this
and (T.FINISHTIME between floor(convert(float, getdate()-60)) andfloor(convert(float, getdate())))