Hello everyone!
So I have a table that has an ID, STATUS, and TIME... sometimes the times are null...
Say the table had this data:
ID STATUS TIME
1 Closed 2010-08-01 03:00:00.000
1 Submitted 2010-08-01 01:00:00.000
1 Deferred 2010-08-01 02:00:00.000
2 Submitted 2010-08-01 01:00:00.000
2 Deferred NULL
What I need it to return is this:
ID START TIME END TIME
1 2010-08-01 01:00:00.000 2010-08-01 03:00:00.000
2 2010-08-01 01:00:00.000 DATE.TIME.NOW
What that does is evaluates the MIN time, then determines the MAX TIME. However, with the Max time I need it to fill in the NULLs with Date.Time.Now.
So say there is a Closed and Deferred
Closed - 2010-08-01 01:00:00.000
Deferred - NULL
The null would enter Date.time.now and I would want that to be returned. Not the closed.
I can't figure it out. I saw some Case structure but it didn't add it as a new column. I guess I need to evaluate Deferred and Closed times together and then pick the max.
Ideas?
So I have a table that has an ID, STATUS, and TIME... sometimes the times are null...
Say the table had this data:
ID STATUS TIME
1 Closed 2010-08-01 03:00:00.000
1 Submitted 2010-08-01 01:00:00.000
1 Deferred 2010-08-01 02:00:00.000
2 Submitted 2010-08-01 01:00:00.000
2 Deferred NULL
What I need it to return is this:
ID START TIME END TIME
1 2010-08-01 01:00:00.000 2010-08-01 03:00:00.000
2 2010-08-01 01:00:00.000 DATE.TIME.NOW
What that does is evaluates the MIN time, then determines the MAX TIME. However, with the Max time I need it to fill in the NULLs with Date.Time.Now.
So say there is a Closed and Deferred
Closed - 2010-08-01 01:00:00.000
Deferred - NULL
The null would enter Date.time.now and I would want that to be returned. Not the closed.
I can't figure it out. I saw some Case structure but it didn't add it as a new column. I guess I need to evaluate Deferred and Closed times together and then pick the max.
Ideas?