I got a SQL table that looks like this :
Code Season DateCreated CPDate QCDate GradeDate MarkingDate FabricDate CutDate
For each code... i will have dates here. Actually, its by order most of the time, what I mean is you will always have a DateCReated.. then next step will be a CPDate and so on. if the users are not arrived to QC it will be null. when the user is done, they will put a date there so gradeDate will still be null but will be next to be updated etc.... and so on.
I need help to do a SELECT that I would do this:
I would like column 1 to be the season, column 2 to be number of days outstanding and column 3-4-5-6..to be CP, QC, Grade, Marking, Fabric and Cut that is the number of CODE inside that numbers of days.
To be more clearer, if a date for 3 Codes above has a null after CPDate and it been 8 days since (getdate()) well you would put 3 in CP
so you see here, i put 3 in CP close to 8 days.
the logic is good for all the rest...
season days CP QC Grade Marking Fabric Cut
Thanks for the help, let me know if you have questions