I have a couple of tables. One is a worker table which displays worker code, firstname and lastname. Job dates which shows worker code, date of job start, end and job area code. Supervisor has worker number, firstname, surname and job area code. Job area has job area code name and supervisor.
What I'm trying to do is display the worker code before date 10/09/10 Since I am new to this, I'm trying to do it all written and theory first before making the database.
Does this sound right? I'm not too sure about the date thing.
select worker
From Job Dates
where job start < '10/09/10'
In theory this sounds right to me, but does it somehow need to tell the query it is a date stamp?
I then want to find the surname of workers and the surnames of their supervisor if the workers started the job before the 10/09/10? I'm guessing this will be with a JOIN?
Thanks
SELECT * FROM PERSONAL WHERE BIRTH_DATE_TIME BETWEEN '2001-03-01 11:00:00' AND '2005-03-01 22:00:00';
SELECT (column name) FROM (table name) WHERE (column name) < DATEADD(Day,-30,GETDATE()); Example.
You're on the right track. Not knowing the schema of your database, your ultimate query will look something like this:
select w.surname, s.surname
From worker w INNER JOIN JobDatesTable jdt on w.id = jdt.id
INNER JOIN SuperVisor s on w.id = s.id
where jdt.jobstart < '20101009'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With