title: MySQL ORDER BY 2 Columns with condition
body: <p>I have the following table, let's call it <code>buildings</code>.</p>
  
  <pre><code>building_code  |  city  |  phone
  1              |  A     |  +1 212 444 555
  2              |  B     |  +2 333 444 555
  3              |  C     |  +3 222 234 122
  4              |  A     |  +1 212 555 444
  </code></pre>
  
  <p>So each city has a few buildings. What I'm trying to do now is select the city and phone number from the buildings. However, I want to sort city by Ascending and also if a city has multiples buildings (example A), then I also want to sort the phone number by Descending order.</p>
  
  <p>The end-result would be</p>
  
  <pre><code>city  |  phone
  A     |  +1 212 555 444
  A     |  +1 212 444 555
  B     |  +2 333 444 555
  C     |  +3 222 234 122
  </code></pre>
  
  <p>So the query I tried is <code>SELECT city, phone FROM buildings ORDER BY city ASC</code>
  This works and sorts city name in Ascending order. However, I am not sure how to order the phone in descending order. </p>
  
  <p>I tried <code>SELECT city, phone FROM buildings ORDER BY city ASC, IF(COUNT(city) &gt; 1, phone, '') DESC;</code> and it gave me an error. </p>