Hi -
I need help with a query. I am getting a error when I try to run (error highlights the word "INNER"). The error message is Syntax error/missing operator.
My query is:
I probably have more mistakes, but can't get past the error on INNER.
Any suggestions? I am stumped. I have not worked much with using 2 of the same table, and labeling them.
In case it helps, what I am trying to do is find the max seq number for each room on a table. The table contains multiple records for a room, and I want to find the latest one (thus, max seq number). I want to examine a different field on this same max record, and that is why I have the inner join.
THANKS.
I need help with a query. I am getting a error when I try to run (error highlights the word "INNER"). The error message is Syntax error/missing operator.
My query is:
Code:
SELECT A.RoomID, Max(ActivitySeqNo) AS MaxSeqNo
FROM tblPestsActivityDetails AS A
GROUP BY RoomID
INNER JOIN
[SELECT RoomID, ActivitySeqNo, ActivityDate FROM tblPestsActivityDetails] AS M
WHERE (M.RoomID = A.RoomID) AND (M.ActivitySeqNo = MaxSeqNo) ORDER BY 1
;
Any suggestions? I am stumped. I have not worked much with using 2 of the same table, and labeling them.
In case it helps, what I am trying to do is find the max seq number for each room on a table. The table contains multiple records for a room, and I want to find the latest one (thus, max seq number). I want to examine a different field on this same max record, and that is why I have the inner join.
THANKS.