title: Mysql error in order by desc
body: <p>this is my query.when i add order by desc in this query its gets an error pls help me.</p>
  
  <pre><code>SELECT *
  FROM
    (SELECT package_details.*,
            r.state AS source_name,
            d.state AS dest_name
     FROM (`package_details`)
     LEFT JOIN country_state_city r ON r.id=package_details.region_id
     LEFT JOIN country_state_city d ON d.id=package_details.destination_id
     WHERE `package_availability_type` = 'all'
       AND `admin_status` = 'ACTIVE'
       AND `status` = 'ACTIVE'
       AND (package_name LIKE '%Istanbul%'
            OR routes LIKE '%Istanbul%'
            OR r.state LIKE '%Istanbul%'
            OR d.state LIKE '%Istanbul%')
       AND
     ORDER BY `package_price` DESC
     UNION ALL SELECT package_details.*,
                      r.state AS source_name,
                      d.state AS dest_name
     FROM (`package_details`)
     LEFT JOIN country_state_city r ON r.id=package_details.region_id
     LEFT JOIN country_state_city d ON d.id=package_details.destination_id
     WHERE `package_availability_type` ='range'
       AND `admin_status` = 'ACTIVE'
       AND `status` = 'ACTIVE'
       AND `to_date` &gt;= '2017-02-07'
       AND (package_name LIKE '%Istanbul%'
            OR routes LIKE '%Istanbul%'
            OR r.state LIKE '%Istanbul%'
            OR d.state LIKE '%Istanbul%')
       AND
     ORDER BY `package_price` DESC) AS dt LIMIT 0,100
  </code></pre>
  
  <p>error:
  You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY <code>package_price</code> DESC UNION ALL SELECT package_details.*,r.state AS sour' at line 1</p>