I have an SQL table as follows:
Ord # Item # Dept Step Step_Completion_Date
123 ABC Packing 1 20041115
123 ABC QC 2 20041120
123 ABC QA 3 20041125
456 DEF Filling 10 20041116
456 DEF QC 20 20041117
456 DEF QA 30 20041121
I am looking for the difference between the date field in the current record and date field in the previous record so I can measure 'turnaround' time for the departments. I have been trying various subselect statements but cannot figure it out.
Ideally I would like a view that contained:
Ord#, Item#, Dept, Step_compl_date, Previous_step_comp_date.
Any help greatly appreciated.