maroulator
asked on
Most recent dates
To whom it may concern,
The attached file represents the output that I get after running a query in MS Access. From this output, I need to pick the records with the most recent and second most recent dates FOR EACH individual.
Does anyone have any ideas?
-Maroulator
Example.xlsx
The attached file represents the output that I get after running a query in MS Access. From this output, I need to pick the records with the most recent and second most recent dates FOR EACH individual.
Does anyone have any ideas?
-Maroulator
Example.xlsx
Do you want to do this in excel? Or you want to modify your Access query to give desired output?
ASKER
I want to modify my Access query. I was thinking of creating a make-table query to produce the output that I have in the attached spreadsheet and then run another query (this is where you come in) to pick the most recent and second most recent dates from the table created out of the make-table query.
I am open to any and all ideas; if you can produce a query that gives me the output in the attached spreadsheet AND picks the most recent and second most recent dates, then so much the better.
Let me know if you have any more questions.
-Maroulator
I am open to any and all ideas; if you can produce a query that gives me the output in the attached spreadsheet AND picks the most recent and second most recent dates, then so much the better.
Let me know if you have any more questions.
-Maroulator
If your query is named qry, you can use this query:
SELECT qry.Name, qry.Salary, qry.Title, qry.Date
FROM qry
WHERE (qry.Date In (SELECT Top 2 [Date] From qry as q Where q.Name = qry.Name Order by q.Date))
ORDER BY qry.Name, qry.Date DESC;
Try not to use reserved words (Date, Name) as field name. In this case you should use square brackets around this field
ASKER
And how can I take the percentage difference between the two records within the same query?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.