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, -18, CURRENT_TIMESTAMP )
THEN 'Adult'
WHEN pats.BirthDate <= DATEADD( year, -1, CURRENT_TIMESTAMP )
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 pat_age
ON pat.PatientKey = pat_age.PatientKey
What is causing the error?
SELECT ONE OF THE FOLLOWING (3 PTS)
A. The join condition must use "pats" instead of "pat_age"
B. PatientKey is not in the SELECT clause of your subquery
C. The join condition must use "pat" instead of "pat_age"
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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!