<?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 Transform table using sql statements in SAP HANA in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/transform-table-using-sql-statements-in-sap-hana/m-p/477045#M15524</link>
    <description>&lt;P&gt;Hallo,&lt;/P&gt;&lt;P&gt;I posted this question yesterday and &lt;STRONG&gt;it has been deleted with a comment, failed to search&lt;/STRONG&gt;, there were many blogs which i have gone through which were done using hana modeler. whereas i need to write the same in SQL. &lt;/P&gt;&lt;P&gt;I am very new to hana environment. I was introduced to write sql quaries to retrieve data from tables.&lt;/P&gt;&lt;P&gt;I have a table in SAP HANA environment with an Id and the items that were ordered by the IDs.&lt;/P&gt;&lt;P&gt;Table is as follows:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;|CustomerID| Items |&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;|Customer1| Item 1|&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;|Customer1| Item 2|&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;|Customer1| Item 3|&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;|Customer1| Item 4|&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;|Customer1| Item 5|&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;|Customer2| Item 1|&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;|Customer2| Item 3|&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;|Customer2| Item 6|&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I would like to transform the table as follows:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;|CustomerID| Item 1| Item 2| Item 3| Item 4| Item 5| Item 6|&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;|Customer1|1|1|1|1|1|0|&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;|Customer2|1|0|1|0|0|1|&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I would like to write a function or procedure that does the task by iterating over the distinct items, as the length of the distinct items column varies according to requirement.&lt;/P&gt;&lt;P&gt;Any help is very much appreciated!&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
    <pubDate>Sun, 28 May 2017 10:58:53 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2017-05-28T10:58:53Z</dc:date>
    <item>
      <title>Transform table using sql statements in SAP HANA</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/transform-table-using-sql-statements-in-sap-hana/m-p/477045#M15524</link>
      <description>&lt;P&gt;Hallo,&lt;/P&gt;&lt;P&gt;I posted this question yesterday and &lt;STRONG&gt;it has been deleted with a comment, failed to search&lt;/STRONG&gt;, there were many blogs which i have gone through which were done using hana modeler. whereas i need to write the same in SQL. &lt;/P&gt;&lt;P&gt;I am very new to hana environment. I was introduced to write sql quaries to retrieve data from tables.&lt;/P&gt;&lt;P&gt;I have a table in SAP HANA environment with an Id and the items that were ordered by the IDs.&lt;/P&gt;&lt;P&gt;Table is as follows:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;|CustomerID| Items |&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;|Customer1| Item 1|&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;|Customer1| Item 2|&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;|Customer1| Item 3|&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;|Customer1| Item 4|&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;|Customer1| Item 5|&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;|Customer2| Item 1|&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;|Customer2| Item 3|&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;|Customer2| Item 6|&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I would like to transform the table as follows:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;|CustomerID| Item 1| Item 2| Item 3| Item 4| Item 5| Item 6|&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;|Customer1|1|1|1|1|1|0|&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;|Customer2|1|0|1|0|0|1|&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I would like to write a function or procedure that does the task by iterating over the distinct items, as the length of the distinct items column varies according to requirement.&lt;/P&gt;&lt;P&gt;Any help is very much appreciated!&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Sun, 28 May 2017 10:58:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/transform-table-using-sql-statements-in-sap-hana/m-p/477045#M15524</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-05-28T10:58:53Z</dc:date>
    </item>
  </channel>
</rss>

