1
SELECT
    Sumps.[_id], Sumps.Machine, Sumps.SumpSize, Sumps.Title, 
    last_cleanout.Reason, last_cleanout.DateStamp, last_cleanout.Sump
FROM
    Sumps

LEFT JOIN ( SELECT c1.*
    FROM Cleanouts as c1
    LEFT JOIN Cleanouts AS c2
         ON c1.Sump = c2.Sump AND c1.DateStamp < c2.DateStamp
    WHERE c2.Sump IS NULL ) AS last_cleanout

ON (Sumps.[_id] = last_cleanout.sump);

Based on an answer from another post on how to LEFT JOIN just one row from another table.

In the query builder, written in the sql view, it works as intended.

But when I try to use it for its intended purpose as record source, it throws an error: "syntax error in FROM clause."

If I then try to edit the sql statement, the same syntax error message is thrown, preventing me from changing it.

Have I made a syntax error? I'm a newbie at access and sql. Any help is greatly appreciated :)

Pypey
  • 11
  • 3

0 Answers0