Hi, I'm writing in PHP and in perl ISP billing software and I have some problems. I have following questions: I need get some column value from previous record and put it to next record column value. It is something like: Contract_id Userid Previous_balance Daily Total Due_balance Record 1: 1 Ganbold 100 10 10 110 Record 2: 1 Ganbold 110 8 8 118 Due-balance=Total+Previous_balance Previous record's Due_balance is next record's Pre_balance How to solve this kind of problem in one query? IS there any way to do that in one query or command? How to solve it in simple way? I need solution which gives me fastest speed. thanks in advance, Ganbold