title: How to order ascending after compare 2 columns value and the condition is whichever lower?
body: <p>I would like to compare 2 prices (price and discount price) and sort by lowest price (after compared) asc.</p>
  
  <p>Here is my sample data</p>
  
  <pre><code>Item | price   | discount_price
  ================================
  1    | 2000.00 | 1500.00
  2    | 89.00   |    0.00
  3    | 60.00   |   50.00
  4    | 59.00   |    0.00
  </code></pre>
  
  <p>Here is my sample code:-</p>
  
  <pre><code>select item, price, discount_price from tableA order by
  GREATEST(price,discount_price) desc
  </code></pre>
  
  <p>Result will show :-</p>
  
  <pre><code>Item | price   | discount_price
  ================================
  1    | 2000.00 | 1500.00
  2    | 89.00   |    0.00
  3    | 60.00   |   50.00
  4    | 59.00   |    0.00
  </code></pre>
  
  <p>What I expected is (get whichever is lower and sort accordingly)</p>
  
  <pre><code>Item | price   | discount_price
  ================================
  1    | 2000.00 | 1500.00
  2    | 89.00   |    0.00
  4    | 59.00   |    0.00
  3    | 60.00   |   50.00
  </code></pre>