In working with table fields, you have to watch out for values which can be null. Change your "count(entity)" to "count(*)". Richard Sims