Instead of (select max(c) from t where n=20)+1
try select coalesce(max(c)+1, 1) from t where n = 20 Regards --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]