title: mysql union give priority to record from one of the select queries in case of duplicates
body: <p>This is my query in a real example :</p>
  
  <pre><code>     SELECT *
   FROM (
  
  (SELECT Deal.DealID, Deal.TitleEn, Deal.CapNum,Deal.ImageLink,
       SUM( Buy.Quantity ) AS Quantity
   FROM Buy, Deal
   WHERE Buy.DealID = Deal.DealID
   AND Buy.IsFinalBuy =  '1'
   GROUP BY Buy.DealID
  HAVING Quantity = Deal.CapNum)
  
  union
  (SELECT Deal.DealID, Deal.TitleEn, Deal.CapNum,Deal.ImageLink,NULL AS Quantity
   FROM Deal
   WHERE Deal.EndDate &lt; CURDATE( ) 
  )
    )A
  
    ORDER BY DealID,TitleEn,CapNum,ImageLink,Quantity ASC
  </code></pre>
  
  <p>I want to give priority to the record from the first select query in case of duplicates . </p>
  
  <p>How can it be done?</p>