Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Select only most recent payment

 
   Database Forums (Home) -> MS Access RSS
Next:  organization and keys  
Author Message
Helen

External


Since: Apr 07, 2006
Posts: 8



(Msg. 1) Posted: Sat Dec 27, 2008 2:46 pm
Post subject: Select only most recent payment
Archived from groups: microsoft>public>access (more info?)

I'm using ACCESS 2003. I'm trying to run a query to list a contributor's
most recent payment of multiple payments per contributor. Following is the
query that I used:

SELECT DISTINCTROW Contributor.NamePart1, Contributor.NamePart2,
Contributor.Status, Payment.PaymentDate, Payment.Amount
FROM Contributor INNER JOIN Payment ON Contributor.ContributorID =
Payment.ContributorID
WHERE (((Contributor.Status)<>"Inactive"))
GROUP BY Contributor.NamePart1, Contributor.NamePart2, Contributor.Status,
Payment.PaymentDate, Payment.Amount
HAVING (([Payment].[PaymentDate]=Max([Payment].[PaymentDate])))

The query runs, but isn't selective. It lists all payments for each
contributor, not just the most recent one.

I would very much appreciate any help!

Helen

 >> Stay informed about: Select only most recent payment 
Back to top
Login to vote
Tom Wickerath

External


Since: Dec 27, 2008
Posts: 1



(Msg. 2) Posted: Sat Dec 27, 2008 3:09 pm
Post subject: Re: Select only most recent payment [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi Helen,

I believe you will need a subquery to solve this problem. Try Access MVP
Allen Browne's tutorials on subqueries:

Subquery basics
http://allenbrowne.com/subquery-01.html

Surviving Subqueries
http://allenbrowne.com/subquery-02.html



Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
_______________________________________________

"Helen" wrote in message


I'm using ACCESS 2003. I'm trying to run a query to list a contributor's
most recent payment of multiple payments per contributor. Following is the
query that I used:

SELECT DISTINCTROW Contributor.NamePart1, Contributor.NamePart2,
Contributor.Status, Payment.PaymentDate, Payment.Amount
FROM Contributor INNER JOIN Payment ON Contributor.ContributorID =
Payment.ContributorID
WHERE (((Contributor.Status)<>"Inactive"))
GROUP BY Contributor.NamePart1, Contributor.NamePart2, Contributor.Status,
Payment.PaymentDate, Payment.Amount
HAVING (([Payment].[PaymentDate]=Max([Payment].[PaymentDate])))

The query runs, but isn't selective. It lists all payments for each
contributor, not just the most recent one.

I would very much appreciate any help!

Helen

 >> Stay informed about: Select only most recent payment 
Back to top
Login to vote
Helen

External


Since: Apr 07, 2006
Posts: 8



(Msg. 3) Posted: Tue Dec 30, 2008 6:35 pm
Post subject: Re: Select only most recent payment [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thanks, Tom.

The subquery worked.

Helen


"Tom Wickerath" wrote:

> Hi Helen,
>
> I believe you will need a subquery to solve this problem. Try Access MVP
> Allen Browne's tutorials on subqueries:
>
> Subquery basics
> http://allenbrowne.com/subquery-01.html
>
> Surviving Subqueries
> http://allenbrowne.com/subquery-02.html
>
>
>
> Tom Wickerath
> Microsoft Access MVP
> http://www.accessmvp.com/TWickerath/
> _______________________________________________
>
> "Helen" wrote in message
>
>
> I'm using ACCESS 2003. I'm trying to run a query to list a contributor's
> most recent payment of multiple payments per contributor. Following is the
> query that I used:
>
> SELECT DISTINCTROW Contributor.NamePart1, Contributor.NamePart2,
> Contributor.Status, Payment.PaymentDate, Payment.Amount
> FROM Contributor INNER JOIN Payment ON Contributor.ContributorID =
> Payment.ContributorID
> WHERE (((Contributor.Status)<>"Inactive"))
> GROUP BY Contributor.NamePart1, Contributor.NamePart2, Contributor.Status,
> Payment.PaymentDate, Payment.Amount
> HAVING (([Payment].[PaymentDate]=Max([Payment].[PaymentDate])))
>
> The query runs, but isn't selective. It lists all payments for each
> contributor, not just the most recent one.
>
> I would very much appreciate any help!
>
> Helen
>
>
>
>
 >> Stay informed about: Select only most recent payment 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Most recent date - I have a databse tracking container movements. I am happily recording each movement and the date of movement and can see where each container is by sorting by date of movement. Is there a way I can produce a query which would show, for each container,....

How can I select only the rows I need? - This is what the data looks like id Sort Program Lender Price Rate Cost APR 1 101 10ARMS 1 62,499.00 5.250% -0.450% 6.256% 2 101 10ARMS 2 62,499.00 5.500% -0.875% 6.344% 3 101 10ARMS 3 62,499.00 5.750% -0.750% 6.486%..

Entering SELECT WHERE expressions - I have 2 tables named "Employee" and "Data". The "Employee" table has the names and numbers of each employee. The "Data" table has a field to select the employee number from a lookup list (from the "Employ...

Select field from table not used by form - I'm working in Access 97 and am mostly a novice. I have a form linked to a table called "Participants". One of the fields is [Company]. I've got a control for it called [Companytxt]. The [Company] field exists in another table called "Pip...

Multi-select no data in table - Hi All, I really hope that someone can help me. I have quite a big database and I have lists boxes on every form. Most need to be multi-select, which they are however what ever I select either doesn't transfer at ALL into the table or only one valu...
   Database Forums (Home) -> MS Access All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]