title: order by clause desc,getting confused between years and months
body: <p>I need to sort warranty in desc order ,but it givces me the months first ,because of the bigger number and then the year on the bottom ,because the number for the year is 1.</p>
  
  <pre><code>  SELECT product_name_us product_name_us,
           product_desc_us product_desc_us,
           product_name_ru product_name_ru,
           product_desc_ru product_desc_ru,
           "Warranty",
           in_stock in_stock
      FROM (  SELECT DISTINCT
                     CASE
                        WHEN pd.language_id = 'US'
                        THEN
                           COALESCE (TO_CHAR (pd.translated_name), ' ')
                     END
                        AS product_name_us,
                     CASE
                        WHEN pd.language_id = 'US'
                        THEN
                           CONCAT (SUBSTR (pd.translated_description, 1, 30),
                                   '...')
                     END
                        AS product_desc_us,
                     CASE
                        WHEN pd.language_id = 'RU'
                        THEN
                           COALESCE (TO_CHAR (pd.translated_name), ' ')
                     END
                        AS product_name_ru,
                     CASE
                        WHEN pd.language_id = 'RU'
                        THEN
                           CONCAT (SUBSTR (pd.translated_description, 1, 30),
                                   '...')
                     END
                        AS product_desc_ru,
                     CASE
                        WHEN pin.warranty_period = '00-00'
                        THEN
                           'No Warranty'
                        WHEN EXTRACT (MONTH FROM pin.warranty_period) = '00'
                        THEN
                           EXTRACT (YEAR FROM pin.warranty_period) || ' years'
                        WHEN EXTRACT (YEAR FROM pin.warranty_period) = '00'
                        THEN
                           EXTRACT (MONTH FROM pin.warranty_period) || ' months'
                        WHEN     EXTRACT (MONTH FROM pin.warranty_period) &lt;&gt; '00'
                             AND EXTRACT (YEAR FROM pin.warranty_period) &lt;&gt; '00'
                        THEN
                              EXTRACT (YEAR FROM pin.warranty_period)
                           || ' years and '
                           || EXTRACT (MONTH FROM pin.warranty_period)
                           || ' months'
                        ELSE
                           'No Warranty'
                     END
                        AS "Warranty",
                     SUM (inv.quantity_on_hand) AS in_stock
                FROM product_descriptions pd
                     INNER JOIN product_information pin
                        ON pd.product_id = pin.product_id
                     INNER JOIN inventories inv ON inv.product_id = pin.product_id
            GROUP BY pd.translated_name,
                     CASE
                        WHEN pd.language_id = 'US'
                        THEN
                           COALESCE (TO_CHAR (pd.translated_name), ' ')
                     END,
                     CASE
                        WHEN pd.language_id = 'US'
                        THEN
                           CONCAT (SUBSTR (pd.translated_description, 1, 30),
                                   '...')
                     END,
                     CASE
                        WHEN pd.language_id = 'RU'
                        THEN
                           COALESCE (TO_CHAR (pd.translated_name), ' ')
                     END,
                     CASE
                        WHEN pd.language_id = 'RU'
                        THEN
                           CONCAT (SUBSTR (pd.translated_description, 1, 30),
                                   '...')
                     END,
                     CASE
                        WHEN pin.warranty_period = '00-00'
                        THEN
                           'No Warranty'
                        WHEN EXTRACT (MONTH FROM pin.warranty_period) = '00'
                        THEN
                           EXTRACT (YEAR FROM pin.warranty_period) || ' years'
                        WHEN EXTRACT (YEAR FROM pin.warranty_period) = '00'
                        THEN
                           EXTRACT (MONTH FROM pin.warranty_period) || ' months'
                        WHEN     EXTRACT (MONTH FROM pin.warranty_period) &lt;&gt; '00'
                             AND EXTRACT (YEAR FROM pin.warranty_period) &lt;&gt; '00'
                        THEN
                              EXTRACT (YEAR FROM pin.warranty_period)
                           || ' years and '
                           || EXTRACT (MONTH FROM pin.warranty_period)
                           || ' months'
                        ELSE
                           'No Warranty'
                     END)
     WHERE     (   product_name_us LIKE '%Monitor%'
                OR product_name_ru LIKE '%Монитор%')
           AND in_stock &lt; 1000
  ORDER BY "Warranty" DESC, product_name_us ASC;
  </code></pre>