Group:  Microsoft Access ยป microsoft.public.access.modulesdaovba
Thread: Capturing most recent zero date

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Capturing most recent zero date
PegGall 21.09.2006 20:04:01
I have a table that is contains a/r balances and I want to get the most
recent date that the balance was 0. Currently there are 65 days worth of
data. I would also want to get the next date that did not have a 0 balance.
Re: Capturing most recent zero date
Marshall Barton <marshbarton[ at ]wowway.com> 21.09.2006 22:28:34
PegGall wrote:

[Quoted Text]
>I have a table that is contains a/r balances and I want to get the most
>recent date that the balance was 0. Currently there are 65 days worth of
>data. I would also want to get the next date that did not have a 0 balance.


SELECT TOP 2 T.datefield, T.balance
FROM table As T
WHERE T.datefield >= (SELECT Max(X.datefield)
FROM table As X
WHERE X.balance = 0)
ORDER BY T.datefield ASC

--
Marsh
MVP [MS Access]

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net