title: Hadoop Hive query to merge rows into one row
body: <p>I need one hive query which merge same EAN rows into one record in table based on priority which is another table. </p>
  
  <p>table: products
     <a href="https://i.stack.imgur.com/YRORK.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YRORK.jpg" alt="enter image description here"></a></p>
  
  <p>As shown in the above image I have different products from different sources(sourceid) and I want only one row by merging all sources data based on below priority. If priority "1" source doesn't provide any field info, that field info  will be taken from  priority "2" source. </p>
  
  <p>Table: priority</p>
  
  <pre><code>node_id Source_id   Priority
  1        62          1
  1        303         2
  1        202         3
  </code></pre>
  
  <p>I am expecting results as shown below.</p>
  
  <p><a href="https://i.stack.imgur.com/udQRC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/udQRC.png" alt="enter image description here"></a></p>