I currently have a query in my database that determines the amount of time that has passed between the time the record was and the time that you are viewing it, it looks like this:
SELECT d.ID, Age AS Expr1, DateDiff("h",d.dateOpened,Now()) & " hrs" AS Age, fl.flavorname, pkg.package, st.status
FROM lut_status AS st INNER JOIN (lut_flavorname AS fl INNER JOIN (lut_packaging AS pkg INNER JOIN record_holddata AS d ON pkg.id = d.package) ON fl.id = d.flavor) ON st.id = d.holdstatus
WHERE (((d.holdStatus)<>7))
ORDER BY d.dateOpened;
There is also a field in that record_holdData table called finalDispoDate that holds a date that the hold item was closed. What I want to do is create a similar query that will use the current time to determine the age of the hold but only if the finalDispoDate field is null; otherwise it will use the value in the finalDispoDate to determine the age of the hold (time between it being created and it being dispositioned).
I know how I would do this programatically but with the way i have my binding set up, I would rather accomplish this in the query. Wasn’t able to find any good examples of this on the net. Any ideas on how I would accomplish this? tia
You could apply the Nz function instead so if the value is NULL you will set a default value for it, here is an example:
SELECT d.ID, Nz(d.another, “Nop”) from lut_status