I got a join select statement and i only need the last modified field in the second table. here’s the select statement that i have now:
SELECT NOM,PRENOM,OEDP.NUM_EMP,N_A_S,SIT_STATUT,PERMIS,DATE_EMBAUCHE,ADRESSE1,VILLE1,PROVINCE1,CODE_POSTAL1,TEL_RESIDENCE
FROM ODS_EMPLOYE_DOSSIER_PERSONNEL AS OEDP
JOIN ODS_SITUATION_POSTE AS OSP
ON OEDP.NUM_EMP = OSP.NUM_EMP
WHERE SIT_DATE_CHG = MAX(SIT_DATE_CHG)
ORDER BY
OEDP.NUM_EMP
i got the folowing erreur msg :
An aggregate may not appear in the WHERE clause unless it is in a subquery contained in a HAVING clause or a select list, and the column being aggregated is an outer reference.
Actually, there are several methods to do this, and their efficiency depends on how the data are distributed across the tables.
See this article in my blog for comparison of these methods: