title: HIVE UNION ALL with clause
body: <p>I have the below mysql update statement. I am trying to convert this into hql using hive 13.(so i do not have any update statement in hive)</p>
  
  <pre><code>UPDATE MY_TABLE.STORE SET
    ADDRESS1 = b.addr_line_1
    ,ADDRESS3 = b.city + ', ' + b.state + ' ' + b.postal_cde
  FROM
    MY_TABLE.STORE a INNER JOIN
    CUST b ON
      a.REGION = b.LOC_NUM
    AND a.STORENUMBER = b.cust_num;
  
  
  UPDATE MY_TABLE.STORE SET
    STORETYPE = b.abc_num
  FROM
    MY_TABLE.STORE a INNER JOIN
    RLT b ON
      a.REGION = b.LOC_NUM
    AND a.STORENUMBER = b.CUST_NUM;
  </code></pre>
  
  <p>Below is my query:</p>
  
  <pre><code>insert into table X
  select b.addr_line_1,CONCAT(B.CITY, ', ', B.STATE, ' ', B.POSTAL_CDE),STORETYPE
  from  MY_TABLE.STORE A JOIN CUST b ON a.REGION = b.LOC_NUM
    AND a.STORENUMBER = b.cust_num t1
  
  UNION ALL
  select ADDRESS1 ,ADDRESS3 ,b.abc_num from  MY_TABLE.STORE a INNER JOIN
    RLT b ON
      a.REGION = b.LOC_NUM
    AND a.STORENUMBER = b.CUST_NUM t2 on t1.id &lt;&gt; t2.id;
  </code></pre>
  
  <p>The above query throws an error for parsing.
  I know there should be 2 queries , 1 if Primary keys are equal and other if they are not equal.</p>
  
  <p>Above query is for equal PK condition.
  where Id is the PK. Any help please. Have been quite long researching on this. </p>