If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Last records from a Group By query
I would like to write a query to find the last (most recent date) records
only from two different fields. No problems using MAX in the ‘Date’ field, the problem being with the ‘Player’ field. I’ve tried using LAST but it seems to throw up incorrect results. thanks, Kevin SELECT tblMain.Team, Last(tblMain.Player) AS LastOfPlayer, Max(tblMain.Date) AS MaxOfDate FROM tblMain RIGHT JOIN tblCurrent ON tblMain.Team = tblCurrent.Team GROUP BY tblMain.Team, tblCurrent.ID ORDER BY tblCurrent.ID; -- Message posted via http://www.accessmonster.com |
#2
|
|||
|
|||
Last records from a Group By query
See if this helps:
Getting a related field from a GroupBy (total) queryat: http://www.mvps.org/access/queries/qry0020.htm -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "KevinE via AccessMonster.com" u19948@uwe wrote in message news:a3e5d8ac52fa7@uwe... I would like to write a query to find the last (most recent date) records only from two different fields. No problems using MAX in the ‘Date’ field, the problem being with the ‘Player’ field. I’ve tried using LAST but it seems to throw up incorrect results. thanks, Kevin SELECT tblMain.Team, Last(tblMain.Player) AS LastOfPlayer, Max(tblMain.Date) AS MaxOfDate FROM tblMain RIGHT JOIN tblCurrent ON tblMain.Team = tblCurrent.Team GROUP BY tblMain.Team, tblCurrent.ID ORDER BY tblCurrent.ID; -- Message posted via http://www.accessmonster.com |
Thread Tools | |
Display Modes | |
|
|