yes, this could get called on quite large tables (maybe notbillions ...). The second solution looks useful - I'll try it on sometest data.
thanks both of you.