<?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: How to merge multiple rows? in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/How-to-merge-multiple-rows/m-p/2235790#M24724</link>
    <description>Hi,&lt;BR /&gt;This could be achieved using denormalization... pl check following scenario, you will get an idea.&lt;BR /&gt;&lt;A href="https://help.talend.com/search/all?query=tDenormalize&amp;amp;content-lang=en" rel="nofollow noopener noreferrer"&gt;https://help.talend.com/search/all?query=tDenormalize&amp;amp;content-lang=en&lt;/A&gt;&lt;BR /&gt;Vaibhav</description>
    <pubDate>Wed, 06 Aug 2014 09:27:05 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2014-08-06T09:27:05Z</dc:date>
    <item>
      <title>How to merge multiple rows?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-merge-multiple-rows/m-p/2235779#M24713</link>
      <description>I have a question about merge multiple rows from DB query. For example, query results:&lt;BR /&gt;  id     col1    col2    col3   col4&lt;BR /&gt;row1  key1  key2    AB      5&lt;BR /&gt;row2  key1  key2    ABC    8&lt;BR /&gt;Merge condition is:&lt;BR /&gt;row1.col1= row2.col1&lt;BR /&gt;and row1.col2=row2.col2&lt;BR /&gt;and row1.col3 like 'AB%'&lt;BR /&gt;and row2.col3 like 'AB%'&lt;BR /&gt;Then let row2.col4 = row2.col4+row1.col4.  So after merge, output should be:&lt;BR /&gt;id       col1   col2   col3    col4&lt;BR /&gt;row2  key1 key2   ABC    13&lt;BR /&gt;How can i make it? Appreciate your help!</description>
      <pubDate>Tue, 05 Jun 2012 07:57:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-merge-multiple-rows/m-p/2235779#M24713</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-06-05T07:57:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge multiple rows?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-merge-multiple-rows/m-p/2235780#M24714</link>
      <description>Hi&lt;BR /&gt;I need to make sure one thing. All these rows are from one table or two table?&lt;BR /&gt;If they are in the same table, how many rows in it?&lt;BR /&gt;Regards,&lt;BR /&gt;Pedro</description>
      <pubDate>Tue, 05 Jun 2012 08:20:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-merge-multiple-rows/m-p/2235780#M24714</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-06-05T08:20:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge multiple rows?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-merge-multiple-rows/m-p/2235781#M24715</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Hi&lt;BR /&gt;I need to make sure one thing. All these rows are from one table or two table?&lt;BR /&gt;If they are in the same table, how many rows in it?&lt;BR /&gt;Regards,&lt;BR /&gt;Pedro&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;Hi, Pedro&lt;BR /&gt;They are from one store procedure result.</description>
      <pubDate>Tue, 05 Jun 2012 08:23:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-merge-multiple-rows/m-p/2235781#M24715</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-06-05T08:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge multiple rows?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-merge-multiple-rows/m-p/2235782#M24716</link>
      <description>Hi&lt;BR /&gt;What about three columns?&lt;BR /&gt;row1  key1  key2    AB      5&lt;BR /&gt;row2  key1  key2    ABC    8&lt;BR /&gt;row3  key1  key3    ABC    3&lt;BR /&gt;What's the rule for row3?&lt;BR /&gt;Regards,&lt;BR /&gt;Pedro</description>
      <pubDate>Tue, 05 Jun 2012 08:29:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-merge-multiple-rows/m-p/2235782#M24716</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-06-05T08:29:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge multiple rows?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-merge-multiple-rows/m-p/2235783#M24717</link>
      <description>&lt;BLOCKQUOTE&gt;
 &lt;TABLE border="1"&gt;
  &lt;TBODY&gt;
   &lt;TR&gt;
    &lt;TD&gt;Hi&lt;BR /&gt;What about three columns?&lt;BR /&gt;row1 key1 key2 AB 5&lt;BR /&gt;row2 key1 key2 ABC 8&lt;BR /&gt;row3 key1 key3 ABC 3&lt;BR /&gt;What's the rule for row3?&lt;BR /&gt;Regards,&lt;BR /&gt;Pedro&lt;/TD&gt;
   &lt;/TR&gt;
  &lt;/TBODY&gt;
 &lt;/TABLE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;BR /&gt;Just output row3 directly, because it couldn't be merged on either row1 or row2. Merge conditon is 
&lt;BR /&gt;row1.col1= row2.col1
&lt;BR /&gt;and row1.col2=row2.col2
&lt;BR /&gt;and row1.col3 like 'AB%'
&lt;BR /&gt;and row2.col3 like 'AB%'
&lt;BR /&gt;if row3.col2 equals key2 not key3, it will be merged! Thanks for your quick reponse.</description>
      <pubDate>Tue, 05 Jun 2012 08:41:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-merge-multiple-rows/m-p/2235783#M24717</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-06-05T08:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge multiple rows?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-merge-multiple-rows/m-p/2235784#M24718</link>
      <description>Hi 
&lt;BR /&gt;You might create a job as the following images. 
&lt;BR /&gt;Code in tJava 
&lt;BR /&gt; 
&lt;PRE&gt;//Code generated according to input schema and output schema&lt;BR /&gt;Pattern pt = Pattern.compile("^AB*.");&lt;BR /&gt;String sm1 = col3_tMemorizeRows_1==null?"":col3_tMemorizeRows_1;&lt;BR /&gt;String sm0 = col3_tMemorizeRows_1; &lt;BR /&gt;String col1_1= col1_tMemorizeRows_1==null?"":col1_tMemorizeRows_1;&lt;BR /&gt;String col2_1= col2_tMemorizeRows_1==null?"":col2_tMemorizeRows_1;&lt;BR /&gt;Matcher m1=pt.matcher(sm1);&lt;BR /&gt;Matcher m0=pt.matcher(sm0);&lt;BR /&gt;if((col1_1.equals(col1_tMemorizeRows_1))&amp;amp;&amp;amp;&lt;BR /&gt;(col2_1.equals(col2_tMemorizeRows_1))&amp;amp;&amp;amp;m1.find()&amp;amp;&amp;amp;m0.find()){&lt;BR /&gt;   output_row.id = id_tMemorizeRows_1;&lt;BR /&gt;   output_row.col1 = col1_tMemorizeRows_1;&lt;BR /&gt;   output_row.col2 = col2_tMemorizeRows_1;&lt;BR /&gt;   output_row.col3 = col3_tMemorizeRows_1;&lt;BR /&gt;   output_row.col4 = col4_tMemorizeRows_1+col4_tMemorizeRows_1;&lt;BR /&gt;}else{&lt;BR /&gt;output_row.id = input_row.id;&lt;BR /&gt;output_row.col1 = input_row.col1;&lt;BR /&gt;output_row.col2 = input_row.col2;&lt;BR /&gt;output_row.col3 = input_row.col3;&lt;BR /&gt;output_row.col4 = input_row.col4;&lt;BR /&gt;}&lt;/PRE&gt; 
&lt;BR /&gt;Regards, 
&lt;BR /&gt;Pedro</description>
      <pubDate>Tue, 05 Jun 2012 10:31:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-merge-multiple-rows/m-p/2235784#M24718</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-06-05T10:31:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge multiple rows?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-merge-multiple-rows/m-p/2235785#M24719</link>
      <description>&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;Hi&lt;BR /&gt;You might create a job as the following images.&lt;BR /&gt;Code in tJava&lt;BR /&gt;&lt;PRE&gt;//Code generated according to input schema and output schema&lt;BR /&gt;Pattern pt = Pattern.compile("^AB*.");&lt;BR /&gt;String sm1 = col3_tMemorizeRows_1==null?"":col3_tMemorizeRows_1;&lt;BR /&gt;String sm0 = col3_tMemorizeRows_1; &lt;BR /&gt;Matcher m1=pt.matcher(sm1);&lt;BR /&gt;Matcher m0=pt.matcher(sm0);&lt;BR /&gt;if((col1_tMemorizeRows_1==col1_tMemorizeRows_1)&amp;amp;&amp;amp;&lt;BR /&gt;(col2_tMemorizeRows_1==col2_tMemorizeRows_1)&amp;amp;&amp;amp;m1.find()&amp;amp;&amp;amp;m0.find()){&lt;BR /&gt;   output_row.id = id_tMemorizeRows_1;&lt;BR /&gt;   output_row.col1 = col1_tMemorizeRows_1;&lt;BR /&gt;   output_row.col2 = col2_tMemorizeRows_1;&lt;BR /&gt;   output_row.col3 = col3_tMemorizeRows_1;&lt;BR /&gt;   output_row.col4 = col4_tMemorizeRows_1+col4_tMemorizeRows_1;&lt;BR /&gt;}else{&lt;BR /&gt;output_row.id = input_row.id;&lt;BR /&gt;output_row.col1 = input_row.col1;&lt;BR /&gt;output_row.col2 = input_row.col2;&lt;BR /&gt;output_row.col3 = input_row.col3;&lt;BR /&gt;output_row.col4 = input_row.col4;&lt;BR /&gt;}&lt;/PRE&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Pedro&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;Hi Pedro, 
&lt;BR /&gt;i am still confused how did you generate the code? where is your merge conditon definition? Thanks a lot.</description>
      <pubDate>Thu, 07 Jun 2012 03:58:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-merge-multiple-rows/m-p/2235785#M24719</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-06-07T03:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge multiple rows?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-merge-multiple-rows/m-p/2235786#M24720</link>
      <description>Hi
&lt;BR /&gt;The merge condition definition is decided by 'if' statement.
&lt;BR /&gt;if((col1_tMemorizeRows_1==col1_tMemorizeRows_1)&amp;amp;&amp;amp;
&lt;BR /&gt;(col2_tMemorizeRows_1==col2_tMemorizeRows_1)&amp;amp;&amp;amp;m1.find()&amp;amp;&amp;amp;m0.find())
&lt;BR /&gt;In fact, your requirement is complicated. It took me time to write these code.
&lt;BR /&gt;Regards,
&lt;BR /&gt;Pedro</description>
      <pubDate>Thu, 07 Jun 2012 04:01:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-merge-multiple-rows/m-p/2235786#M24720</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-06-07T04:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge multiple rows?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-merge-multiple-rows/m-p/2235787#M24721</link>
      <description>&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;Hi&lt;BR /&gt;The merge condition definition is decided by 'if' statement.&lt;BR /&gt;if((col1_tMemorizeRows_1==col1_tMemorizeRows_1)&amp;amp;&amp;amp;&lt;BR /&gt;(col2_tMemorizeRows_1==col2_tMemorizeRows_1)&amp;amp;&amp;amp;m1.find()&amp;amp;&amp;amp;m0.find())&lt;BR /&gt;In fact, your requirement is complicated. It took me time to write these code.&lt;BR /&gt;Regards,&lt;BR /&gt;Pedro&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;Thanks again, Pedro. But looks like records are not merged. 
&lt;BR /&gt;input: 
&lt;BR /&gt;row1;key1;key2;AB;5 
&lt;BR /&gt;row2;key1;key2;ABC;8 
&lt;BR /&gt;row3;key1;key3;ABC;3 
&lt;BR /&gt;output should be: 
&lt;BR /&gt;row2;key1;key2;ABC;13 
&lt;BR /&gt;row3;key1;key3;ABC;3</description>
      <pubDate>Thu, 07 Jun 2012 04:29:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-merge-multiple-rows/m-p/2235787#M24721</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-06-07T04:29:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge multiple rows?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-merge-multiple-rows/m-p/2235788#M24722</link>
      <description>Hi
&lt;BR /&gt;I have corrected my mistake.
&lt;BR /&gt;You will see the right solution at Comment #6 this time.
&lt;BR /&gt;Besides, you have to remove the first line manually.
&lt;BR /&gt;Regards,
&lt;BR /&gt;Pedro</description>
      <pubDate>Thu, 07 Jun 2012 04:39:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-merge-multiple-rows/m-p/2235788#M24722</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-06-07T04:39:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge multiple rows?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-merge-multiple-rows/m-p/2235789#M24723</link>
      <description>Hi,
&lt;BR /&gt;I need solution on the below query.
&lt;BR /&gt;i have two tables table A, table B
&lt;BR /&gt;Table A has one column task_id
&lt;BR /&gt;Table B has two cols task_id,task_status
&lt;BR /&gt;task_id &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;status
&lt;BR /&gt;----------- &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-----------------
&lt;BR /&gt;10 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;in progress
&lt;BR /&gt;10 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;completed&amp;nbsp;
&lt;BR /&gt;I need table c to have&amp;nbsp;
&lt;BR /&gt;task_id &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;history_status
&lt;BR /&gt;---------- &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ---------------
&lt;BR /&gt;10 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;in progress,completed&amp;nbsp;
&lt;BR /&gt;thanks
&lt;BR /&gt;Devashsi</description>
      <pubDate>Tue, 05 Aug 2014 20:43:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-merge-multiple-rows/m-p/2235789#M24723</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-08-05T20:43:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge multiple rows?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-merge-multiple-rows/m-p/2235790#M24724</link>
      <description>Hi,&lt;BR /&gt;This could be achieved using denormalization... pl check following scenario, you will get an idea.&lt;BR /&gt;&lt;A href="https://help.talend.com/search/all?query=tDenormalize&amp;amp;content-lang=en" rel="nofollow noopener noreferrer"&gt;https://help.talend.com/search/all?query=tDenormalize&amp;amp;content-lang=en&lt;/A&gt;&lt;BR /&gt;Vaibhav</description>
      <pubDate>Wed, 06 Aug 2014 09:27:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-merge-multiple-rows/m-p/2235790#M24724</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-08-06T09:27:05Z</dc:date>
    </item>
  </channel>
</rss>

