<?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: Merging 2 tables- diff columns, need 1 record in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Merging-2-tables-diff-columns-need-1-record/m-p/233715#M85243</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello John&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I stumble across this post and this is exactly what I was looking for in solving merging two QVDs together with different columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I needed to load old legacy ERP Supplier data with new ERP Supplier data and only show the missing Suppliers that were NOT in the new ERP system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, below script solved the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Les&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Master:&lt;BR /&gt; &lt;SPAN style="color: #113afc;"&gt;&lt;STRONG&gt;LOAD&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #113afc;"&gt;Text&lt;/SPAN&gt;(&lt;SPAN style="color: #7f2408;"&gt;[Supplier Id]&lt;/SPAN&gt;) &lt;SPAN style="color: #113afc;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: #7f2408;"&gt;"Supplier Id"&lt;/SPAN&gt;,&lt;BR /&gt; 'R' &lt;SPAN style="color: #113afc;"&gt;AS&lt;/SPAN&gt; &lt;SPAN style="color: #7f2408;"&gt;RType&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #113afc;"&gt;FROM&lt;/SPAN&gt;&lt;BR /&gt; [..\Data\Vendors\Suppliers.qvd]&lt;BR /&gt; (&lt;SPAN style="color: #113afc;"&gt;qvd&lt;/SPAN&gt;)&lt;BR /&gt; ;&lt;BR /&gt; &lt;SPAN style="color: #113afc;"&gt;OUTER&lt;/SPAN&gt; &lt;SPAN style="color: #113afc;"&gt;JOIN&lt;/SPAN&gt; (Master)&lt;BR /&gt; &lt;SPAN style="color: #113afc;"&gt;&lt;STRONG&gt;LOAD&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #113afc;"&gt;Text&lt;/SPAN&gt;(&lt;SPAN style="color: #7f2408;"&gt;[Supplier Id]&lt;/SPAN&gt;) &lt;SPAN style="color: #113afc;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: #7f2408;"&gt;"Supplier Id"&lt;/SPAN&gt;&lt;BR /&gt; ,&lt;SPAN style="color: #7f2408;"&gt;Supplier&lt;/SPAN&gt; &lt;SPAN style="color: #113afc;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: #7f2408;"&gt;FSupplier&lt;/SPAN&gt;,&lt;BR /&gt; &lt;SPAN style="color: #7f2408;"&gt;[Supplier Full Name]&lt;/SPAN&gt; &lt;SPAN style="color: #113afc;"&gt;AS&lt;/SPAN&gt; &lt;SPAN style="color: #7f2408;"&gt;FName&lt;/SPAN&gt;,&lt;BR /&gt; 'F' &lt;SPAN style="color: #113afc;"&gt;AS&lt;/SPAN&gt; &lt;SPAN style="color: #7f2408;"&gt;FType&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #113afc;"&gt;FROM&lt;/SPAN&gt;&lt;BR /&gt; [..\Data\Vendors\FSSuppliers.qvd]&lt;BR /&gt; (&lt;SPAN style="color: #113afc;"&gt;qvd&lt;/SPAN&gt;)&lt;BR /&gt; ;&lt;BR /&gt; &lt;BR /&gt; FSSupplier:&lt;BR /&gt; &lt;SPAN style="color: #113afc;"&gt;&lt;STRONG&gt;LOAD&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #7f2408;"&gt;[Supplier Id]&lt;/SPAN&gt;&lt;BR /&gt; ,&lt;SPAN style="color: #7f2408;"&gt;FSupplier&lt;/SPAN&gt; &lt;SPAN style="color: #113afc;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: #7f2408;"&gt;Supplier&lt;/SPAN&gt;&lt;BR /&gt; ,&lt;SPAN style="color: #7f2408;"&gt;FName&lt;/SPAN&gt; &lt;SPAN style="color: #113afc;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: #7f2408;"&gt;"Supplier Full Name"&lt;/SPAN&gt;&lt;BR /&gt; ,&lt;SPAN style="color: #7f2408;"&gt;FType&lt;/SPAN&gt; &lt;SPAN style="color: #113afc;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: #7f2408;"&gt;"Type"&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #113afc;"&gt;RESIDENT&lt;/SPAN&gt; Master&lt;BR /&gt; &lt;SPAN style="color: #113afc;"&gt;WHERE&lt;/SPAN&gt; &lt;SPAN style="color: #113afc;"&gt;IsNull&lt;/SPAN&gt;(&lt;SPAN style="color: #7f2408;"&gt;RType&lt;/SPAN&gt;) &lt;SPAN style="color: #113afc;"&gt;and&lt;/SPAN&gt; &lt;SPAN style="color: #7f2408;"&gt;FType&lt;/SPAN&gt;='F'&lt;BR /&gt; ;&lt;BR /&gt; &lt;BR /&gt; &lt;SPAN style="color: #113afc;"&gt;&lt;STRONG&gt;DROP&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #113afc;"&gt;TABLE&lt;/SPAN&gt; Master; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Results:&amp;nbsp; FSSupplier only contains Suppliers that were in the old legacy ERP system and NOT in the new ERP system that we purchased.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 23 Jul 2012 17:05:02 GMT</pubDate>
    <dc:creator>ljhowell</dc:creator>
    <dc:date>2012-07-23T17:05:02Z</dc:date>
    <item>
      <title>Merging 2 tables- diff columns, need 1 record</title>
      <link>https://community.qlik.com/t5/QlikView/Merging-2-tables-diff-columns-need-1-record/m-p/233712#M85240</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Regarding my script... goal is a single Master file that contains unique schoolIDs, with respective SchoolName and SchoolType.&lt;/P&gt;&lt;P&gt;Thus, to combine/merge two datasets(ds), let's use T and P, where P has two columns and T has 3 columns. Some SchoolID values will be common in both, and some different, hence why we want to combine for a Master SchoolID ds. We want to also pull in the SchoolName and SchoolType for each SchoolID.&lt;/P&gt;&lt;P&gt;For each SchoolID, the SchoolName MUST be the same, but of course it's not... they are similar in several cases and one may have an extra space, or a hyphen, i.e. Smoky Hill HS vs. Smoky Hill High School.&lt;/P&gt;&lt;P&gt;For SchoolType, only T has this field, values are either a text string or Null.&lt;/P&gt;&lt;P&gt;RULE: if there are multiple name values for a given schoolid, 1) keep only a single record and 2) from table "B:" (more current) .&lt;/P&gt;&lt;P&gt;I've tried a day's worth of things and decided it's time to ask the experts... OUTER JOIN, vs. Where not exists vs. MaxString.... please advise.&lt;/P&gt;&lt;P&gt;I really want to say something like this...&lt;/P&gt;&lt;P&gt;Names:&lt;/P&gt;&lt;P&gt;LOAD * from P&lt;/P&gt;&lt;P&gt;OUTER JOIN LOAD * from T&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;if T and P then keep P SchoolNames but bring in T's SchoolType&lt;/LI&gt;&lt;LI&gt;otherwise, merge by SchoolID // expect no issues merging for single SchoolID record&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Please help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Stephanie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 May 2010 16:07:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Merging-2-tables-diff-columns-need-1-record/m-p/233712#M85240</guid>
      <dc:creator />
      <dc:date>2010-05-06T16:07:22Z</dc:date>
    </item>
    <item>
      <title>Merging 2 tables- diff columns, need 1 record</title>
      <link>https://community.qlik.com/t5/QlikView/Merging-2-tables-diff-columns-need-1-record/m-p/233713#M85241</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe this?&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;Master:&lt;BR /&gt;LOAD&lt;BR /&gt; SchoolID&lt;BR /&gt;,SchoolName as PSchoolName&lt;BR /&gt;FROM P&lt;BR /&gt;;&lt;BR /&gt;OUTER JOIN (Master)&lt;BR /&gt;LOAD&lt;BR /&gt; SchoolID&lt;BR /&gt;,SchoolName as TSchoolName&lt;BR /&gt;,SchoolType&lt;BR /&gt;FROM T&lt;BR /&gt;;&lt;BR /&gt;LEFT JOIN (Master)&lt;BR /&gt;LOAD&lt;BR /&gt; SchoolID&lt;BR /&gt;,if(len(PSchoolName),PSchoolName,TSchoolName) as SchoolName&lt;BR /&gt;RESIDENT Master&lt;BR /&gt;;&lt;BR /&gt;DROP FIELDS&lt;BR /&gt; PSchoolName&lt;BR /&gt;,TSchoolName&lt;BR /&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 May 2010 22:16:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Merging-2-tables-diff-columns-need-1-record/m-p/233713#M85241</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-05-06T22:16:30Z</dc:date>
    </item>
    <item>
      <title>Merging 2 tables- diff columns, need 1 record</title>
      <link>https://community.qlik.com/t5/QlikView/Merging-2-tables-diff-columns-need-1-record/m-p/233714#M85242</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi John,&lt;/P&gt;&lt;P&gt;thanks for the solution idea. I also came up with a workaround very similar to yours except I left SchoolName as the same column name, and used "MaxString" for SchoolName and then for SchoolType. It was a few extra steps. Your way makes good sense since we know that SchoolName and SchoolType have different values and should not JOIN on them... hence the "len" option.&lt;/P&gt;&lt;P&gt;Thanks for your time and response.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stephanie Lind&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 May 2010 15:59:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Merging-2-tables-diff-columns-need-1-record/m-p/233714#M85242</guid>
      <dc:creator />
      <dc:date>2010-05-07T15:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: Merging 2 tables- diff columns, need 1 record</title>
      <link>https://community.qlik.com/t5/QlikView/Merging-2-tables-diff-columns-need-1-record/m-p/233715#M85243</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello John&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I stumble across this post and this is exactly what I was looking for in solving merging two QVDs together with different columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I needed to load old legacy ERP Supplier data with new ERP Supplier data and only show the missing Suppliers that were NOT in the new ERP system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, below script solved the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Les&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Master:&lt;BR /&gt; &lt;SPAN style="color: #113afc;"&gt;&lt;STRONG&gt;LOAD&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #113afc;"&gt;Text&lt;/SPAN&gt;(&lt;SPAN style="color: #7f2408;"&gt;[Supplier Id]&lt;/SPAN&gt;) &lt;SPAN style="color: #113afc;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: #7f2408;"&gt;"Supplier Id"&lt;/SPAN&gt;,&lt;BR /&gt; 'R' &lt;SPAN style="color: #113afc;"&gt;AS&lt;/SPAN&gt; &lt;SPAN style="color: #7f2408;"&gt;RType&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #113afc;"&gt;FROM&lt;/SPAN&gt;&lt;BR /&gt; [..\Data\Vendors\Suppliers.qvd]&lt;BR /&gt; (&lt;SPAN style="color: #113afc;"&gt;qvd&lt;/SPAN&gt;)&lt;BR /&gt; ;&lt;BR /&gt; &lt;SPAN style="color: #113afc;"&gt;OUTER&lt;/SPAN&gt; &lt;SPAN style="color: #113afc;"&gt;JOIN&lt;/SPAN&gt; (Master)&lt;BR /&gt; &lt;SPAN style="color: #113afc;"&gt;&lt;STRONG&gt;LOAD&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #113afc;"&gt;Text&lt;/SPAN&gt;(&lt;SPAN style="color: #7f2408;"&gt;[Supplier Id]&lt;/SPAN&gt;) &lt;SPAN style="color: #113afc;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: #7f2408;"&gt;"Supplier Id"&lt;/SPAN&gt;&lt;BR /&gt; ,&lt;SPAN style="color: #7f2408;"&gt;Supplier&lt;/SPAN&gt; &lt;SPAN style="color: #113afc;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: #7f2408;"&gt;FSupplier&lt;/SPAN&gt;,&lt;BR /&gt; &lt;SPAN style="color: #7f2408;"&gt;[Supplier Full Name]&lt;/SPAN&gt; &lt;SPAN style="color: #113afc;"&gt;AS&lt;/SPAN&gt; &lt;SPAN style="color: #7f2408;"&gt;FName&lt;/SPAN&gt;,&lt;BR /&gt; 'F' &lt;SPAN style="color: #113afc;"&gt;AS&lt;/SPAN&gt; &lt;SPAN style="color: #7f2408;"&gt;FType&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #113afc;"&gt;FROM&lt;/SPAN&gt;&lt;BR /&gt; [..\Data\Vendors\FSSuppliers.qvd]&lt;BR /&gt; (&lt;SPAN style="color: #113afc;"&gt;qvd&lt;/SPAN&gt;)&lt;BR /&gt; ;&lt;BR /&gt; &lt;BR /&gt; FSSupplier:&lt;BR /&gt; &lt;SPAN style="color: #113afc;"&gt;&lt;STRONG&gt;LOAD&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #7f2408;"&gt;[Supplier Id]&lt;/SPAN&gt;&lt;BR /&gt; ,&lt;SPAN style="color: #7f2408;"&gt;FSupplier&lt;/SPAN&gt; &lt;SPAN style="color: #113afc;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: #7f2408;"&gt;Supplier&lt;/SPAN&gt;&lt;BR /&gt; ,&lt;SPAN style="color: #7f2408;"&gt;FName&lt;/SPAN&gt; &lt;SPAN style="color: #113afc;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: #7f2408;"&gt;"Supplier Full Name"&lt;/SPAN&gt;&lt;BR /&gt; ,&lt;SPAN style="color: #7f2408;"&gt;FType&lt;/SPAN&gt; &lt;SPAN style="color: #113afc;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: #7f2408;"&gt;"Type"&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="color: #113afc;"&gt;RESIDENT&lt;/SPAN&gt; Master&lt;BR /&gt; &lt;SPAN style="color: #113afc;"&gt;WHERE&lt;/SPAN&gt; &lt;SPAN style="color: #113afc;"&gt;IsNull&lt;/SPAN&gt;(&lt;SPAN style="color: #7f2408;"&gt;RType&lt;/SPAN&gt;) &lt;SPAN style="color: #113afc;"&gt;and&lt;/SPAN&gt; &lt;SPAN style="color: #7f2408;"&gt;FType&lt;/SPAN&gt;='F'&lt;BR /&gt; ;&lt;BR /&gt; &lt;BR /&gt; &lt;SPAN style="color: #113afc;"&gt;&lt;STRONG&gt;DROP&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #113afc;"&gt;TABLE&lt;/SPAN&gt; Master; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Results:&amp;nbsp; FSSupplier only contains Suppliers that were in the old legacy ERP system and NOT in the new ERP system that we purchased.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2012 17:05:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Merging-2-tables-diff-columns-need-1-record/m-p/233715#M85243</guid>
      <dc:creator>ljhowell</dc:creator>
      <dc:date>2012-07-23T17:05:02Z</dc:date>
    </item>
  </channel>
</rss>

