Access 2007 Query to return latest date note from subquery -
i have 2 tables joined projectid
in access 2007. table structure of primary table (a)
projectid | custid 1 | 5 2 | 8
i have secondary table (b) of notes on projectid, structured
projectnotesid | projectid | note | createdate --------------------------------------------------- 1 | 1 | note11 | 1/2/2015 2 | 1 | note12 | 2/2/2015 3 | 2 | note21 | 4/8/2015 4 | 2 | note22 | 3/5/2015
i want return of, or part of, table a, latest note of table b,
projectid | custid | note | createdate ------------------------------------------ 1 | 5 | note12 | 2/2/2015 2 | 8 | note21 | 4/8/2015
i can (and have done) php & mysql, can't work in access 2007. can return projectid , latest note date following query in access 2007
select projectid, max(createdate) maxofcreatedate table b group projectid;
i have tried unique values, etc., can't results looking for.
thanks!
pete
i found answer. first, changed query got latest date, , instead got max projectnotesid. query ::
select projectid, max(projectnotesid) maxofprojectnotesid table b group projectid;
i created second query combining above query , table b, joining query.maxofprojectnotesid <-> tableb.projectnotesid, , query.projectid <-> tableb.projectid. second query pulls values tableb.
Comments
Post a Comment