I am trying to run some SQLcode that returns the record with the Maximum startdate. I am using an Select statement with an inner join.
See code below.
Select
t1.CH_Name_Initials as FirstName,
t1.surname as Surname,
t1.dt_start as StartDate,
t1.dt_DOB as DateofBirth
from
tb_Pers t1
inner join
(SELECT CH_Name_Initials, surname, dt_start,MAX(dt_start) as max_date,
dt_DOB
FROM
tb_Pers t2
group by
CH_Name_Initials,
t1.surname)
s2
on
t1.CH_Name_Initials = t2.CH_Name_Initials
and t1.surname = t2.surname
and t1.dt_start = t2.dt_start
and t1.dt_DOB = t2.dt_DOB
How ever when I try and run it I get the error message
Details: "ODBC: ERROR [42000] [Microsoft][ODBC Microsoft Access Driver] Syntax error in JOIN operation
I understand Access requres multiple brackets but I am struggling to find where to put them?
Thanks
Chris