Count objects in joins