SQL query to display a daily timeline of tasks
Hi,
I am in need of some SQL help and guidance to help me display a list of tasks in a timeline format, I have searched the forums and google for hours on end and cannot find an example that can help me with this challenge.
I have a simple table with the following columns:
job no
engineer
start time
end time
and some example data would be similar to:
(I have used dashed lines --- to illustrate spaces as the preview appears to remove them)
JOB_NO---ENGINEER----START_TIME-----------END_TIME
1------------john------------16-APR-09 09:00----16-APR-09 10:00
2------------steve-----------16-APR-09 09:00----16-APR-09 10:00
3------------steve-----------16-APR-09 10:00----16-APR-09 12:00
4------------steve-----------16-APR-09 13:00----16-APR-09 14:00
5------------john------------16-APR-09 12:00-----16-APR-09 15:00
6------------dave-----------16-APR-09 10:00-----16-APR-09 11:00
I would like to create a report which shows a day view with hours from 08:00 to 18:00 and what jobs are allocated to what engineer on that day, which means I need to somehow show the hours of the day even if no jobs have been allocated for a specific period. The output I have in mind is:
ENGINEER--08:00--09:00--10:00--11:00--12:00--13:00--14:00--15:00--16:00--17:00--18:00
john--------------------11111------------------666666666666666
steve------------------22222--3333333333-------------444444
dave-----------------------------66666
where the numbers indicate the Job No that has been allocated to that period
I have seen some examples in the forum that use LIMIT clause but I can't figure out how to use it for displaying hours.
Any advice you guys could provide would be very much appreciated.
Best regards,
stu