Query to find all jobs that work started on a certain day
I have a table containing jobs and dates that work was done on these jobs:
Job Date Work Done
A 01 Jan 2013
A 02 Jan 2013
A 03 Jan 2013
B 02 Jan 2013
B 03 Jan 2013
C 03 Jan 2013
I want to know which jobs started on say 02 Jan 2013 - the answer is job 'B'.
What would be the query for this?
Thanks.
Re: Query to find all jobs that work started on a certain day
SELECT job FROM tableName WHERE [date work done] = #2/1/2013#
Re: Query to find all jobs that work started on a certain day
Am I right in saying that you don't want Job A because that actually started on the 1st of Jan? I.E. you want jobs whose lowest date is 2/1?
If so I think you actually want this:-
Select Job
From MyTable
Group By Job
Having MIN([Date Work Done]) = '2013-01-02'
Be warned, though, that doesn't account for non-contiguous date ranges. So a job that was worked on the 2nd, 3rd, 6th and 7th would be returned if you query for the 2nd but not the 6th.