Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inner Join problems

Status
Not open for further replies.

daffelito

Technical User
Joined
Sep 18, 2008
Messages
7
Location
SE
Hi i got this Query that gives me the results of the most recent dates. It looks like this
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);
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.
 
No help needed, i solved it by my selfe. All i had to to was to create a relation between the query and the other table, and then create an other query.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top