How do I compare hire date to MS SQL system date?

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:
select
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.


garyjgsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sridharthirunagariCommented:
select
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

try this..
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
LowfatspreadCommented:
and a.datehired between convert(datetime, convert(char(8),dateadd(d,-30,getdate()),112)) and getdate()
0
garyjgsAuthor Commented:
thanks...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.