SQL Question

rcomo

Senior member
Jan 21, 2004
227
0
0
In my current job I am learning SQL - while having to write valid SQL statements. I need some help designing a query that checks hire dates for establishing participation for (something).

So the statement establishing participation has to have a WHERE clause that will check HIRE_DATE and establish two different goals:

1. WHERE Hire_Date < OCTOBER 1 of this current year
2. WHERE Hire_Date < OCTOBER 1 of previous year



Different question now that I am thinking about it: some of these previous SQL statements have a @ symbol, what does that mean in SQL? Can't find an online resource that references that symbol :(
Example: IF @Type IN ('Workflow','All')

Thanks for the help in advance.

Rob
 

Patt

Diamond Member
Jan 30, 2000
5,288
2
81
@ denotes a variable in a statement if I remember correctly.

What database are you writing against? SQL Server or Oracle?
 

Patt

Diamond Member
Jan 30, 2000
5,288
2
81
use the GetDate() function ... it pulls the current system date.

select * from emp_history
where effective_date <= getdate()

This pulls all employee records where the effective date is less than or equal to today.

select * from emp_history
where eff_date <= getdate() - 30

This pulls all employee records where the effective date is less than or equal to today - 30 days (i.e. July 1st)