i have three tables Pproject, ProjectMilestone and ReleaseSchedule.
i want to add a derived field to the project table called EndDate.
the value of this new field called EndDate should be the larger of the two values ProjectMilestone.EndDate and ReleaseSchedule.EndDate.
the SQL logic to get the two data points of EndDate within both those tables is like this:
select EndDate from ProjectMilestone where MilestoneCID = 77 and projectId = project.projectId
select EndDate from ReleaseSchedule where MilestoneCID = 77 releaseId = project.releaseId
so i basically need the derived field to be the larger of these 2 values and if neither value exist to have 'N/A'
i am at this point trying to get the case statement to work...
ALTER TABLE Project ADD EndDate AS (CASE WHEN ProjectMilestone.EndDate < ReleaseSchedule.EndDate THEN ProjectMilestone.EndDate ELSE ReleaseSchedule.EndDate END)
how do i get N/A if both are null?
thanks all