<?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: Resident Load Where exists in resident table in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Resident-Load-Where-exists-in-resident-table/m-p/484806#M181107</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;where exists(table1,table2) in your case exists(Id, RefferingID) I should also commet away RefferingID in your Table1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//Staffan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 Dec 2013 22:33:50 GMT</pubDate>
    <dc:creator>stabben23</dc:creator>
    <dc:date>2013-12-13T22:33:50Z</dc:date>
    <item>
      <title>Resident Load Where exists in resident table</title>
      <link>https://community.qlik.com/t5/QlikView/Resident-Load-Where-exists-in-resident-table/m-p/484804#M181105</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have loaded table that has an id field and for that record it may have been referred by another id.&amp;nbsp; I need to create a new table from table with the details for the id's where they were a referring id.&amp;nbsp; I've been trying to use the Where Exists on the resident table but I must be missing something since it always generates zero rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table1:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;Id,&lt;/P&gt;&lt;P&gt;Date1,&lt;/P&gt;&lt;P&gt;Date2,&lt;/P&gt;&lt;P&gt;Name&lt;/P&gt;&lt;P&gt;ReferringID&lt;/P&gt;&lt;P&gt;SQL Select * from mySQLSource;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table2:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;Id as ReferringID,&lt;/P&gt;&lt;P&gt;Date1,&lt;/P&gt;&lt;P&gt;Date2,&lt;/P&gt;&lt;P&gt;Name&lt;/P&gt;&lt;P&gt;Resident Table1&lt;/P&gt;&lt;P&gt;where exists (ReferringID,Id);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I was going to do it in SQL the result I would look for would be like this&lt;/P&gt;&lt;P&gt;Select *&lt;/P&gt;&lt;P&gt;from mySQLSource&lt;/P&gt;&lt;P&gt;where Id in (Select ReferringID from mySQLSource)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but I'm trying not to query that sql source again since it's already been loaded in Qlikview and it has a lot of overhead associated with it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is what I'm trying to do even possible, to have the resident sub-select from itself?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any input appreciated.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Lorna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Dec 2013 20:15:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Resident-Load-Where-exists-in-resident-table/m-p/484804#M181105</guid>
      <dc:creator />
      <dc:date>2013-12-13T20:15:34Z</dc:date>
    </item>
    <item>
      <title>Re: Resident Load Where exists in resident table</title>
      <link>https://community.qlik.com/t5/QlikView/Resident-Load-Where-exists-in-resident-table/m-p/484805#M181106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Table2:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;ReferringID as ID&lt;/P&gt;&lt;P&gt;resident Table1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Will load a list of those people who were referrers from your first table. (You may need to keep DISTINCT in mind)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can then do a LEFT JOIN back to Table1 joining on the ID in order to pull ther persons name or whatever other data you want. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Dec 2013 20:22:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Resident-Load-Where-exists-in-resident-table/m-p/484805#M181106</guid>
      <dc:creator />
      <dc:date>2013-12-13T20:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: Resident Load Where exists in resident table</title>
      <link>https://community.qlik.com/t5/QlikView/Resident-Load-Where-exists-in-resident-table/m-p/484806#M181107</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;where exists(table1,table2) in your case exists(Id, RefferingID) I should also commet away RefferingID in your Table1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//Staffan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Dec 2013 22:33:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Resident-Load-Where-exists-in-resident-table/m-p/484806#M181107</guid>
      <dc:creator>stabben23</dc:creator>
      <dc:date>2013-12-13T22:33:50Z</dc:date>
    </item>
    <item>
      <title>Re: Resident Load Where exists in resident table</title>
      <link>https://community.qlik.com/t5/QlikView/Resident-Load-Where-exists-in-resident-table/m-p/484807#M181108</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Works for me. For example:&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13871159575947231" jivemacro_uid="_13871159575947231"&gt;
&lt;P&gt;X1:&lt;/P&gt;
&lt;P&gt;load * inline [&lt;/P&gt;
&lt;P&gt;ID, Name, ReferringID&lt;/P&gt;
&lt;P&gt;1, a, 2&lt;/P&gt;
&lt;P&gt;2, b, 5&lt;/P&gt;
&lt;P&gt;3, c, 4&lt;/P&gt;
&lt;P&gt;4, d, 6&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;X2:&lt;/P&gt;
&lt;P&gt;load ID as ReferringID, Name&lt;/P&gt;
&lt;P&gt;Resident X1&lt;/P&gt;
&lt;P&gt;where Exists(ReferringID,ID) ;&lt;/P&gt;



&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A &lt;EM&gt;keep left&lt;/EM&gt; should do the same, so that's another thing you can try. In both cases you will end up with a synthetic key unless you concatenate the tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That said I'd go for another approach:&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13871159575477291" jivemacro_uid="_13871159575477291"&gt;
&lt;P&gt;Table1:&lt;/P&gt;
&lt;P&gt;select Id, Date1, Date2, Name, ReferringID from mySQLSource;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;store Table1 into Table1.qvd;&lt;/P&gt;
&lt;P&gt;drop table Table1;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Temp:&lt;/P&gt;
&lt;P&gt;load ReferringID from Table1.qvd (qvd);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Table1:&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: rgba(0, 0, 0, 0); font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;load *, if(exists(ReferringID,Id),1,0) as IsReferredID from Table1.qvd (qvd);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: rgba(0, 0, 0, 0); font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;drop Table Temp;&lt;/P&gt;



&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This way every ID gets a 1 in a new field IsReferredID if the ID is referred to by another ID. That makes it easy to find/select those ID's.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Dec 2013 12:47:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Resident-Load-Where-exists-in-resident-table/m-p/484807#M181108</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-12-15T12:47:34Z</dc:date>
    </item>
    <item>
      <title>Re: Resident Load Where exists in resident table</title>
      <link>https://community.qlik.com/t5/QlikView/Resident-Load-Where-exists-in-resident-table/m-p/484808#M181109</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the help everyone.&amp;nbsp; I did end up going with the 'left join' method but I will be able to put the other suggestions in to use in other places.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Dec 2013 17:34:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Resident-Load-Where-exists-in-resident-table/m-p/484808#M181109</guid>
      <dc:creator />
      <dc:date>2013-12-18T17:34:56Z</dc:date>
    </item>
  </channel>
</rss>

