Hi i got this Query that gives me the results of the most recent dates. It looks like this
The Column "PumpgropsID" is the ID from another table and it's a autonumber. But what i want is to show is the namne of that id (wich is in another column of that table) and I just dont know where to put it.
It would be something like: SELECT tbl2.Pumgrop WHERE tbl1.PumpgropsID = tbl2.ID
But i dont know where to put it in this query, i have tryed but it wont give me any results.
Code:
SELECT t.id, t.PumpgropsID, t.DateNeed, t.DateCleaned
FROM tblSlamTomning AS t INNER JOIN [SELECT PumpgropsID,
MAX(DateNeed) AS MaxNeed
FROM tblSlamTomning
GROUP BY PumpgropsID
HAVING MAX(DateNeed) > MAX(DateCleaned)
]. AS m ON (m.MaxNeed=t.DateNeed) AND (m.PumpgropsID=t.PumpgropsID);
It would be something like: SELECT tbl2.Pumgrop WHERE tbl1.PumpgropsID = tbl2.ID
But i dont know where to put it in this query, i have tryed but it wont give me any results.