<?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: Retrieve data from multiple source tables with different structures in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Retrieve-data-from-multiple-source-tables-with-different/m-p/2265747#M45189</link>
    <description>&lt;P&gt;I think you can simply achieve &amp;nbsp;by using outer join and distinct clause .why do u need union.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In Talend, &amp;nbsp;you can&amp;nbsp;do this by using tELT components .&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 08 Jun 2017 22:39:13 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-06-08T22:39:13Z</dc:date>
    <item>
      <title>Retrieve data from multiple source tables with different structures</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Retrieve-data-from-multiple-source-tables-with-different/m-p/2265746#M45188</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I want to collect data from several tables in one tmp table&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to retrieve changes made to an ID.&lt;/P&gt; 
&lt;P&gt;The source tables have different structures, so for collect data I use UNION in&amp;nbsp;tMSSqlInput :&lt;/P&gt; 
&lt;P&gt;SELECT DISTINCT&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;ID,&lt;BR /&gt;FirstName,&lt;BR /&gt;LastName,&lt;BR /&gt;DateName,&lt;BR /&gt;Email,&lt;BR /&gt;DateEmail&lt;BR /&gt;PhoneNumber,&lt;BR /&gt;DatePhone,&lt;BR /&gt;OperationDate&lt;BR /&gt;FROM&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;(&lt;BR /&gt;SELECT DISTINCT&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;ID,&lt;BR /&gt;FirstName,&lt;BR /&gt;LastName,&lt;BR /&gt;DateName,&lt;BR /&gt;'' AS Email,&lt;BR /&gt;'' AS DateEmail,&lt;BR /&gt;'' AS PhoneNumber,&lt;BR /&gt;'' AS DatePhone,&lt;BR /&gt;DateName AS OperationDate&lt;BR /&gt;FROM Table1&lt;/P&gt; 
&lt;P&gt;UNION&lt;/P&gt; 
&lt;P&gt;SELECT DISTINCT&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;ID,&lt;BR /&gt;'' AS FirstName,&lt;BR /&gt;'' AS LastName,&lt;BR /&gt;'' AS DateName,&lt;BR /&gt;Email,&lt;BR /&gt;DateEmail,&lt;BR /&gt;'' AS PhoneNumber,&lt;BR /&gt;'' AS DatePhone,&lt;BR /&gt;DateEmail AS OperationDate&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;FROM table2&lt;/P&gt; 
&lt;P&gt;UNION&lt;/P&gt; 
&lt;P&gt;SELECT DISTINCT&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;ID,&lt;BR /&gt;'' AS FirstName,&lt;BR /&gt;'' AS LastName,&lt;BR /&gt;'' AS DateName,&lt;BR /&gt;'' AS Email,&lt;BR /&gt;'' AS DateEmail,&lt;BR /&gt;PhoneNumber,&lt;BR /&gt;DatePhone,&lt;BR /&gt;DatePhone AS OperationDate&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;FROM table2&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;) as t&lt;/P&gt; 
&lt;P&gt;ORDER BY ID, OperationDate desc&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;the result is like that :&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="img_438.jpg" style="width: 913px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009Lue8.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/145911i8ACDBA569FA83862/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009Lue8.jpg" alt="0683p000009Lue8.jpg" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;I make updates&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to fill the blank fields: using the tmp table in the first time, then from another table which contains the latest data for each id :&lt;/P&gt; 
&lt;P&gt;UPDATE tmp&lt;BR /&gt;SET tmp.LastName = tmp2.LastName&lt;BR /&gt;FROM #tmp tmp&lt;BR /&gt;INNER JOIN #tmp tmp2 ON tmp2.Id = tmp.Id AND tmp.OperationDate &amp;gt;= tmp2.OperationDate&lt;BR /&gt;WHERE (tmp.LastName is null or tmp.LastName = '')&lt;BR /&gt;AND (tmp2.LastName is not null and tmp2.LastName &amp;lt;&amp;gt; '')&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;The final result must be like this :&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="img_439.jpg" style="width: 912px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LuQS.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/140456i2B8A01DC4E3598BF/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LuQS.jpg" alt="0683p000009LuQS.jpg" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;Table which&amp;nbsp;contains the latest data for each id (old values for ID 1) :&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="img_440.jpg" style="width: 774px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LuIi.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/147386iA3BE426129C74429/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LuIi.jpg" alt="0683p000009LuIi.jpg" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;This table stores the last information for each id after each execution of the job (another job).&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Is there another easier way to&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;change empty fields using Talend component or SQL Scrip ?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Thank you in advance for your replies,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2017 17:44:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Retrieve-data-from-multiple-source-tables-with-different/m-p/2265746#M45188</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-06-08T17:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve data from multiple source tables with different structures</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Retrieve-data-from-multiple-source-tables-with-different/m-p/2265747#M45189</link>
      <description>&lt;P&gt;I think you can simply achieve &amp;nbsp;by using outer join and distinct clause .why do u need union.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In Talend, &amp;nbsp;you can&amp;nbsp;do this by using tELT components .&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2017 22:39:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Retrieve-data-from-multiple-source-tables-with-different/m-p/2265747#M45189</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-06-08T22:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve data from multiple source tables with different structures</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Retrieve-data-from-multiple-source-tables-with-different/m-p/2265748#M45190</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;The Outer join doesn't work because I want get all data : all lines with all field filled in with the value of the last line. And I'm not sure that all my source tables contain a line for an ID.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm looking for and testing the tELT components.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks you,&lt;/P&gt;&lt;P&gt;FELA&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2017 10:22:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Retrieve-data-from-multiple-source-tables-with-different/m-p/2265748#M45190</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-06-12T10:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve data from multiple source tables with different structures</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Retrieve-data-from-multiple-source-tables-with-different/m-p/2265749#M45191</link>
      <description>&lt;P&gt;Hello FELA,&lt;/P&gt;
&lt;P&gt;Are the tELT* components Ok with you? Is your issue fixed now? Feek free to post your issue here.&lt;/P&gt;
&lt;P&gt;Best regards&lt;/P&gt;
&lt;P&gt;Sabrina&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2017 09:36:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Retrieve-data-from-multiple-source-tables-with-different/m-p/2265749#M45191</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-25T09:36:37Z</dc:date>
    </item>
  </channel>
</rss>

