Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

More on loop

Status
Not open for further replies.

SBTBILL

Programmer
Joined
May 1, 2000
Messages
515
Location
US
I need to get the ending balance of the last beginning and ending balance of a customer. Back dating into previous periods is possible. That is the last record could be 201004 but the transaction is occurring in 201002. A 201003 record may or may not exist. Changing the 201002 record will change the ending balance for 201002, 201003, 201004. It will also change the beginning balance for 201003 and 201004.

Suggestions
 
Can you show some sample data (in table form) and expected results?

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
can you use a

select min(fieldname) ,max(fieldname) from tablename where accountid=98976

or a

select (select max(fieldname) from table where date='4/1/2010'),(select max(fieldname) from table where date='4/2/2010')

?

you could perform more filtering using the where clause..
i.e. restrict to a date..


I am thinking the second should work.


 
Don't think max should work. One of the things I need to do is change all the records after the first one. The first one get changed in one field ending balance. Each subsequent record gets changed in two fields beginning balance and ending balance. While right now I have very little data because we are just starting this program it can grow quite rapidly.

The fields are Dist_id, Period, Income, Outgo, Beginning_balance, Ending_balance

In the long run can't compute from the beginning of time. This is a header table for monthly statements. While I don't expect back dates to be much more then 2 months, once in a blue moon may get one that goes back further. Also will end up crossing fiscal years at times.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top