azzazzello
Technical User
I have a Table which has, among other fields, 3 TIME fields. 1 of them is a basically a start time (starttime), and the other 2 are end times of an event (endtime1 and endtime2). I won't get into the details of why there are 2 end times, but suffice it to say that they may both have values, only one of them may have a value (while the other is NULL), or neither may have a value. My query is selecting records where EITHER one of them has a value (because I can use either). Here is my dilhema - I need to do something like this:
SELECT Sum(endtime1 - starttime) as total,... FROM ... WHERE (endtime1 IS NOT NULL OR endtime2 IS NOT NULL) .... GROUP BY total.
But what if endtime1 is NULL and endtime2 is the one that contains the actual time? Is there some way I can quickly determine which is NOT null and use that one in my calculation?
SELECT Sum(endtime1 - starttime) as total,... FROM ... WHERE (endtime1 IS NOT NULL OR endtime2 IS NOT NULL) .... GROUP BY total.
But what if endtime1 is NULL and endtime2 is the one that contains the actual time? Is there some way I can quickly determine which is NOT null and use that one in my calculation?