Generic Count() for all tables (with optional where clause)