This is the query in IBM DB2...
select (days(max(end_dt)) - days(min(bgn_dt)) + 1) - sum(days(coalesce(end_dt, Current_timestamp)) - days(bgn_dt) + 1) as OffRent
from rental
where id = 2395
I tried using to_date instead of days.I was not succesful.
end_dt and bgn_dt are of type date.so i have trouble dealing with this.any body can give me query in oracle for this.
select (days(max(end_dt)) - days(min(bgn_dt)) + 1) - sum(days(coalesce(end_dt, Current_timestamp)) - days(bgn_dt) + 1) as OffRent
from rental
where id = 2395
I tried using to_date instead of days.I was not succesful.
end_dt and bgn_dt are of type date.so i have trouble dealing with this.any body can give me query in oracle for this.