<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: How to merge two rows having same values into single row in HIVE? in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/How-to-merge-two-rows-having-same-values-into-single-row-in/m-p/188715#M150808</link>
    <description>&lt;P&gt;Hi. collect_list should be able to achieve what you want:&lt;/P&gt;&lt;PRE&gt;select id
    ,name
    ,dob
    ,concat_ws(',',collect_list(location)) as location
from test_analysis
group by id
    ,name
    ,dob
&lt;/PRE&gt;&lt;P&gt;I found the solution here: &lt;A href="https://stackoverflow.com/questions/44770037/hive-pivot-and-sum"&gt;https://stackoverflow.com/questions/44770037/hive-pivot-and-sum&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Output should look like this:&lt;/P&gt;&lt;PRE&gt;1       Bob     08/10/1985      New Jersey,New York,North Carolina
2       John    26/11/1990      Oklahoma
&lt;/PRE&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
    <pubDate>Fri, 03 Nov 2017 18:19:57 GMT</pubDate>
    <dc:creator>ian_stokes1</dc:creator>
    <dc:date>2017-11-03T18:19:57Z</dc:date>
  </channel>
</rss>

