Look up a value in a table based on a date

Act            Date                   Acct_Bal
1               05/01/2006        1000.00
1               05/05/2006         3000.00
1               05/20/2006         -500.00
1               05/21/2006         4000.00
1               05/24/2006         -200.00

If I want to know what is the account balance on 5/7/2009, I want the query to return 3,000.00 the value on 5/5.  The highest value before the next change on 5/20
ed_jAsked:
Who is Participating?
 
Aneesh RetnakaranConnect With a Mentor Database AdministratorCommented:
SELECT TOP 1 Acct_Bal
where date <='5/7/2009'
order by date desc
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.