I'm getting an error (invalid columnname 'ClientKey')when I check the syntax for this statement below. If i remove the Select in the From clause, every thing is ok except the wrong records show up. I need the most recent record from the Intake table.
Anybody with an idea on how to achieve this?
Thanks!
CREATE VIEW dbo.ClientDemographics
AS
SELECT
a.ClientKey AS 'Client ID',
a.Age AS Age,
a.CLIENT_Gender AS Gender,
a.RACE AS 'Ethnic Origin',
a.Marital_Status AS 'Marital Status'
FROM CLIENT AS a,
(Select top 1 Level_Education,Current_Employment
from Intake_Assess
order by intake_date desc) AS i
where a.ClientKey = i.ClientKey
Anybody with an idea on how to achieve this?
Thanks!
CREATE VIEW dbo.ClientDemographics
AS
SELECT
a.ClientKey AS 'Client ID',
a.Age AS Age,
a.CLIENT_Gender AS Gender,
a.RACE AS 'Ethnic Origin',
a.Marital_Status AS 'Marital Status'
FROM CLIENT AS a,
(Select top 1 Level_Education,Current_Employment
from Intake_Assess
order by intake_date desc) AS i
where a.ClientKey = i.ClientKey