One from Last Record (1 Viewer)

nuttychick

Registered User.
Local time
Today, 10:10
Joined
Jan 16, 2004
Messages
84
Hiya,
Not sure if this is possible via a query.

I have a table containing RAG information for studies, and I simply want to retrieve not the last record for each study, but the one before last.
One of my customers would like a report (athough big report so will just be a query exported to excel) that shows the last RAG and the one previous for each study.

Can I do this in a query?:confused:

here is the SQL code for my query so far (creating this section first and will add it to the big query after)
Code:
SELECT tblRAGData.ID, tblRAGData.Overall, tblRAGData.[Study Code] FROM tblRAGData;
 

namliam

The Mailman - AWF VIP
Local time
Today, 11:10
Joined
Aug 11, 2003
Messages
11,695
#1 Dont use spaces in your column names....

First select the max per study then do again a max but with an outer join (excluding) the previous max...

I hope that makes some sence...
 

nuttychick

Registered User.
Local time
Today, 10:10
Joined
Jan 16, 2004
Messages
84
Thanks namliam,

I know - tell me about the spaces! Its an inherited database and full them! Its easier to work with them than change them at this point...

I know what you are getting at, I did have a quick try but failed, so thought I'd ask before I spent ages trying to do something that perhaps wasn't possible!
I will have a go...at least now I know its possible I can persevere!

Thank you
 

Users who are viewing this thread

Top Bottom