title: CakePHP: How do I order results based on a 2-level deep association model?
body: <p>I'm hoping I won't need to resort to custom queries.</p>
  
  <p>A related question would be: how do I retrieve data so that if an associated model is empty, no record is retrieved at all, as opposed to an empty array for an associated model?</p>
  
  <p>As an oversimplified example, say I have the following models:
  City --> Street --> House</p>
  
  <p>How do I sort City results by House numbers?</p>
  
  <p>How do I retrieve City restuls that have at least one House in it?  I don't want a record with a city name and details and an empty House array as it messes up pagination results.</p>
  
  <p>CakePHP retrieves House records belonging to the Street in a separate query, so putting somthing like 'House.number DESC' into the 'order' field of the search query returns a 'field does not exist' error.</p>
  
  <p>Any ideas?</p>