Problem with multi join query

  • Thread starter Thread starter Van T. Dinh
  • Start date Start date
V

Van T. Dinh

Post the SQL of your attempt on the current Status and the
corresponding (max) date.

Van T. Dinh
MVP (Access)
 
Van,
You forced me to take another look and try again, and
guess what, it seems to work.
Below is what I came up with.
Thanks for your non-help.
Walter

--------------
SELECT A.SocialWorkerId AS SWId, [tbl_SOCIALWORKER].
[SOCIALWORKER], A.Date AS MaxOfDate, [tbl_CLIENTS].
[LAST], [tbl_CLIENTS].[FIRST], A.ClientId, D.StatusDate,
D.Status
FROM ((tbl_ClientSW AS A INNER JOIN tbl_CLIENTS ON
A.ClientId=[tbl_CLIENTS].[CLIENTID]) INNER JOIN
tbl_SOCIALWORKER ON A.SocialWorkerId=[tbl_SOCIALWORKER].
[SOCIALWORKERID]) INNER JOIN tbl_ClientStatus AS D ON
[tbl_CLIENTS].[CLIENTID]=D.ClientId
WHERE (((A.Date)=(SELECT MAX(B.Date) FROM tbl_ClientSW AS
B WHERE A.ClientId = B.ClientId)) AND ((D.StatusDate)=
(SELECT MAX(E.StatusDate) FROM tbl_ClientStatus AS E
WHERE D.ClientId = E.ClientId)));

--------------
 
Back
Top