At 05:42 PM 7/5/2005, Bernie Lis wrote:
I would count the number of records first, if it is 0 then my next payments no. would be 1. If it is 3, then the next payment no. would be 4
The following technique should give you exactly what you want to achieve. SET VAR vPaymentNo INTEGER = 0 SELECT (MAX(PaymentNo)+1) INTO vPaymentNo INDIC iv1PaymentNo + FROM Payments WHERE OrderNo = 9596097 Have fun! Very Best R:egards, Razzak.
