I have a MS SQl query that I want to know date hired for the last 30 days when comparing to MS SQL system date. For example:
A.COMPANY as "Company"
,A.EMPLOYEE as "Employee"
, A.FIRST_NAME as "First Name"
, A.MIDDLE_NAME as "Middle Name"
, A.LAST_NAME as "Last Name"
, A.SUPERVISOR as "Supervisor"
, A.EMP_STATUS as "Employee Status"
, A.DATE_HIRED as "Date Hired"
, A.ADJ_HIRE_DATE as "Adj Hire Date"
, A.TERM_DATE as "Term Date"
, SPR.FIRST_NAME "Supervisor First Name"
, SPR.MIDDLE_NAME as "Supervisor Middle Name"
, SPR.LAST_NAME as "Supervisor Last Name"
, SPR.EMAIL_ADDRESS as "Supervisor Email"
FROM EMPLOYEE A
LEFT JOIN HRSUPER HRS
ON A.SUPERVISOR = HRS.CODE
AND A.COMPANY = HRS.COMPANY
LEFT JOIN EMPLOYEE SPR
ON SPR.COMPANY = HRS.COMPANY
AND SPR.EMPLOYEE = HRS.EMPLOYEE
WHERE A.SUPERVISOR >='1000-10000'
AND SPR.EMAIL_ADDRESS > ' '
AND A.DATE_HIRED = GETDATE()-30
I use GETDATE()-30 and no records are returned. I know there are records there, though.