I am using confluence to track the risks and the table has these columns:
- Risk Detail
- Open Date
- Status - (Open/Closed)
- Closed Date
- Aging (in days)
- Remarks
I am calculating the aging by using the below query for the open issues.
SELECT *, ROUND(DATEDIFF(day,'Open Date',CURRENT_TIMESTAMP))+ " day(s)" as 'Aging' from T1
For the closed issues, I need to find the elapsed time between Open and Closed dates.
So can someone help me to construct the query to check if the status is closed then use this query
SELECT *, ROUND(DATEDIFF(day,'Open Date',CURRENT_TIMESTAMP))+ " day(s)" as 'Aging' from T1
Else
SELECT *, ROUND(DATEDIFF(day,'Open Date','Closed Date'))+ " day(s)" as 'Aging' from T1