Modified query for occupancies