troubleshooting Question

Oracle SQL Max Date

Avatar of shieldsco
shieldscoFlag for United States of America asked on
* Oracle PL/SQLSQL
3 Comments1 Solution9 ViewsLast Modified:
In the table below I'm trying to select the max task complete date when the task type = 'Pre-schedule Review ' else I want the task complete date. Thanks
Task TypeTask StatusTask Completed Date
Pre-schedule ReviewClosed 2021-01-21 14:53:41.0 
Pre-schedule Review Closed 2021-03-24 10:23:55.0 
Pre-schedule Review Closed 2021-03-22 10:42:14.0 


Select Distinct
TY.C_NAME as "Task Type"
,TS.C_NAME as "Task Status"
,Case
When TY.C_NAME  = 'Pre-schedule Review' Then  (Select MAX (TA.C_COMPLETED_DT ) FROM T_APPEAL_TASK Where TA.C_TASK_TYPE = TY.ID)
Else TA.C_COMPLETED_DT  End as "Task Completed Date"

From
T_APL A

LEFT OUTER JOIN T_APPEAL_TASK TA ON A.ID = TA.ID_BASE
Left outer join T_APPEAL_TASK_TYPE TY on TA.C_TASK_TYPE = TY.ID
Left outer join T_APPEAL_TASK_STATUS TS on TA.C_TASK_STATUS = TS.ID


ASKER CERTIFIED SOLUTION
Alex [***Alex140181***]
Software Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros