Question: SELECT CASE WHEN pats.BirthDate < = DATEADD ( year, - 1 8 , CURRENT _ TIMESTAMP ) THEN 'Adult' WHEN pats.BirthDate < = DATEADD (
SELECT
CASE
WHEN pats.BirthDate DATEADD year, CURRENTTIMESTAMP
THEN 'Adult'
WHEN pats.BirthDate DATEADD year, CURRENTTIMESTAMP
THEN 'Child'
WHEN pats.BirthDate IS NOT NULL
THEN 'Infant'
ELSE 'Missing Birthdate'
END PatientAgeGroup
FROM
PatientDim pats
However, when you try to join to this subquery, shown below, you get an error.
SELECT
Name
PatientAgeGroup
FROM
PatientDim pat
INNER JOIN patage
ON pat.PatientKey patage.PatientKey
What is causing the error?
SELECT ONE OF THE FOLLOWING PTS
A The join condition must use "pats" instead of "patage"
B PatientKey is not in the SELECT clause of your subquery
C The join condition must use "pat" instead of "patage"
D Name is not in the SELECT clause of your subquery
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
