finding most recent records



Hi all!

I have a query that pulls information from three different tables. It works great, but I would like it to return only the most recent record for each CharID.

stats_tbl.dated is a date field

I believe I should be using the MAX function, but can't seem to get it in the right place in the right syntax.

Any help would be very much appreciated.
Kathy

Here is the SQL

SELECT character_tbl.charID, character_tbl.Cname, character_tbl.playerID, player_tbl.reg, stats_tbl.laston, stats_tbl.dated
FROM (player_tbl RIGHT JOIN character_tbl ON player_tbl.playerID = character_tbl.playerID) LEFT JOIN stats_tbl ON character_tbl.charID = stats_tbl.charID
WHERE (((player_tbl.reg) Is Null Or (player_tbl.reg)=0) AND ((stats_tbl.laston)<>"3_months"))
ORDER BY character_tbl.Cname;
.



Relevant Pages

  • RE: EXISTS reserved word in FROM clause
    ... we make a good pair because I know Access SQL ... from what you described the query syntax that I ... >The subquery should return the records: ...
    (microsoft.public.access.queries)
  • Re: access cmd to sql server "grant insert on.."
    ... You need to create a SPT query. ... This uses the syntax of the SERVER. ... Ditto for SQL Server. ...
    (microsoft.public.access.externaldata)
  • Re: SSAS: Processing Cube hangs
    ... Your LEFT JOIN query should not be that much faster than the query that ... syntax that is effectively be equivalent to using inner joins. ... The query optimizer in SQL Server knows how to work with both syntaxes ... Dimension User: about 200 records ...
    (microsoft.public.sqlserver.olap)
  • RE: Use of IF then Else syntax in Access
    ... I'll post a sample of a pass-thru query that I use in a separate message. ... It should give you an idea of the syntax differences. ... that the dbo_ before the table name gets changed to dbo. ... go to query on the menu and choose sql specific, ...
    (microsoft.public.access.queries)
  • RE: EXISTS reserved word in FROM clause
    ... we make a good pair because I know Access SQL ... from what you described the query syntax that I ... > from a set of segments bearing the same name. ...
    (microsoft.public.access.queries)