<?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>topic Re: Objective is to make table unique at ID using group by , concat_ws and collect_list ,combining distinct values in one row. in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/objective-is-to-make-table-unique-at-id-using-group-by-concat-ws/m-p/9748#M5063</link>
    <description>&lt;P&gt;use split or Explode here ,it will work&lt;/P&gt;</description>
    <pubDate>Wed, 08 Feb 2023 12:04:25 GMT</pubDate>
    <dc:creator>Aviral-Bhardwaj</dc:creator>
    <dc:date>2023-02-08T12:04:25Z</dc:date>
    <item>
      <title>Objective is to make table unique at ID using group by , concat_ws and collect_list ,combining distinct values in one row.</title>
      <link>https://community.databricks.com/t5/data-engineering/objective-is-to-make-table-unique-at-id-using-group-by-concat-ws/m-p/9747#M5062</link>
      <description>&lt;P&gt;&lt;I&gt;Objective is to make table unique at ID. Table structure is as in attached image.&lt;/I&gt;&lt;/P&gt;&lt;P&gt;Query used is :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;B&gt;select&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;ID,&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;&lt;I&gt;concat_ws(' &amp;amp; ' , collect_list(Distinct Gender)) as Gender&lt;/I&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;from table&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;group by ID&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It can be possible if we can order values within collect_list and then concat but I can't figure out how to do that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@Hubert Dudek​&amp;nbsp;@Werner Stinckens​&amp;nbsp;@Aviral Bhardwaj​&amp;nbsp;@Hemanth A​&amp;nbsp;@Omkar G​&amp;nbsp;@Yogita Chavan​&amp;nbsp;@Gam Nguyen​&amp;nbsp;@Aman Sehgal​&amp;nbsp;@Ajay Pandey​&amp;nbsp;@pat​&amp;nbsp;@Hau Nguyen​&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2023 11:45:09 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/objective-is-to-make-table-unique-at-id-using-group-by-concat-ws/m-p/9747#M5062</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-08T11:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: Objective is to make table unique at ID using group by , concat_ws and collect_list ,combining distinct values in one row.</title>
      <link>https://community.databricks.com/t5/data-engineering/objective-is-to-make-table-unique-at-id-using-group-by-concat-ws/m-p/9748#M5063</link>
      <description>&lt;P&gt;use split or Explode here ,it will work&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2023 12:04:25 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/objective-is-to-make-table-unique-at-id-using-group-by-concat-ws/m-p/9748#M5063</guid>
      <dc:creator>Aviral-Bhardwaj</dc:creator>
      <dc:date>2023-02-08T12:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: Objective is to make table unique at ID using group by , concat_ws and collect_list ,combining distinct values in one row.</title>
      <link>https://community.databricks.com/t5/data-engineering/objective-is-to-make-table-unique-at-id-using-group-by-concat-ws/m-p/9749#M5064</link>
      <description>&lt;P&gt;Does this help?&lt;/P&gt;&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/46580253/collect-list-by-preserving-order-based-on-another-variable" target="test_blank"&gt;https://stackoverflow.com/questions/46580253/collect-list-by-preserving-order-based-on-another-variable&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/59782602/groupby-and-collect-list-maintaining-order-based-on-another-column-in-pyspark" target="test_blank"&gt;https://stackoverflow.com/questions/59782602/groupby-and-collect-list-maintaining-order-based-on-another-column-in-pyspark&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2023 12:27:14 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/objective-is-to-make-table-unique-at-id-using-group-by-concat-ws/m-p/9749#M5064</guid>
      <dc:creator>-werners-</dc:creator>
      <dc:date>2023-02-08T12:27:14Z</dc:date>
    </item>
    <item>
      <title>Re: Objective is to make table unique at ID using group by , concat_ws and collect_list ,combining distinct values in one row.</title>
      <link>https://community.databricks.com/t5/data-engineering/objective-is-to-make-table-unique-at-id-using-group-by-concat-ws/m-p/9750#M5065</link>
      <description>&lt;P&gt;here I have to join multiple values in one row. Split and explode will be used when we have to convert list/array into different rows&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2023 12:37:17 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/objective-is-to-make-table-unique-at-id-using-group-by-concat-ws/m-p/9750#M5065</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-08T12:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: Objective is to make table unique at ID using group by , concat_ws and collect_list ,combining distinct values in one row.</title>
      <link>https://community.databricks.com/t5/data-engineering/objective-is-to-make-table-unique-at-id-using-group-by-concat-ws/m-p/9751#M5066</link>
      <description>&lt;P&gt;Hi @Rishabh Shanker​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for posting your question in our community! We are happy to assist you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To help us provide you with the most accurate information, could you please take a moment to review the responses and select the one that best answers your question?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will also help other community members who may have similar questions in the future. Thank you for your participation and let us know if you need any further assistance!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2023 08:37:37 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/objective-is-to-make-table-unique-at-id-using-group-by-concat-ws/m-p/9751#M5066</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-04-10T08:37:37Z</dc:date>
    </item>
  </channel>
</rss>

