Identifying column with next date

  • I have a table with fields for task milestones, i.e., start proposal date, start review date, finish review date, submit to client date, etc.

    I need to identify what the next date will be and the associated milestone. How can I do this?

    TIA

    Dean

  • SELECT CASE WHEN start proposal date < start review date AND start proposal date <  finish review date AND start proposal date < submit to client date THEN start proposal date

    ELSE CASE WHEN ....

     

    END AS Next Date.

     

    You can also do 1 subquery per data column and do union all between them.  Then selec the min date which is past yesterday!?.

  • Thanks, that makes sense, but I don't understand how I will be able to identify which column got selected.

  • Use the union all version.  Then add the column name as a varchr description column.  The other way to do it is to le the application reversve engeneer this one (recheck each column to see which is the next available).  But if you were to do that, you could avoid the problem altogether.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply