<?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 Sub load in a sql select in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Sub-load-in-a-sql-select/m-p/1663513#M49873</link>
    <description>&lt;P&gt;When I load many tables in a data load scripts, I ussually do this way:&lt;/P&gt;&lt;P&gt;Table1:&lt;/P&gt;&lt;P&gt;Load *;&lt;/P&gt;&lt;P&gt;SQL select a,b,c from datasource1 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table 2:&lt;/P&gt;&lt;P&gt;Load * &lt;U&gt;&lt;STRONG&gt;where exists (a);&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;SQL select a,e,f from datasource2 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem here is when the select in datasource2 is huge, I want to limit the value of select instead of select all then filter by where exists(a) in load later.&lt;/P&gt;&lt;P&gt;Is there any way to implement it like:&lt;/P&gt;&lt;P&gt;Table1:&lt;/P&gt;&lt;P&gt;Load *;&lt;/P&gt;&lt;P&gt;SQL select a,b,c from datasource1 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table 2:&lt;/P&gt;&lt;P&gt;Load *&lt;U&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;SQL select a,e,f from datasource2 where a in (Load a resident Table1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried some solutions, but still not success. An examble:&lt;/P&gt;&lt;P&gt;Table1:&lt;/P&gt;&lt;P&gt;Load *;&lt;/P&gt;&lt;P&gt;SQL select a,b,c from datasource1 ;&lt;/P&gt;&lt;P&gt;let vListA = Concat(a, ',') ; // Always return NULL&lt;/P&gt;&lt;P&gt;Table 2:&lt;/P&gt;&lt;P&gt;Load *&lt;U&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;SQL select a,e,f from datasource2 where a in ('$(vListA)');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 19:20:54 GMT</pubDate>
    <dc:creator>thi_pham</dc:creator>
    <dc:date>2024-11-16T19:20:54Z</dc:date>
    <item>
      <title>Sub load in a sql select</title>
      <link>https://community.qlik.com/t5/App-Development/Sub-load-in-a-sql-select/m-p/1663513#M49873</link>
      <description>&lt;P&gt;When I load many tables in a data load scripts, I ussually do this way:&lt;/P&gt;&lt;P&gt;Table1:&lt;/P&gt;&lt;P&gt;Load *;&lt;/P&gt;&lt;P&gt;SQL select a,b,c from datasource1 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table 2:&lt;/P&gt;&lt;P&gt;Load * &lt;U&gt;&lt;STRONG&gt;where exists (a);&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;SQL select a,e,f from datasource2 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem here is when the select in datasource2 is huge, I want to limit the value of select instead of select all then filter by where exists(a) in load later.&lt;/P&gt;&lt;P&gt;Is there any way to implement it like:&lt;/P&gt;&lt;P&gt;Table1:&lt;/P&gt;&lt;P&gt;Load *;&lt;/P&gt;&lt;P&gt;SQL select a,b,c from datasource1 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table 2:&lt;/P&gt;&lt;P&gt;Load *&lt;U&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;SQL select a,e,f from datasource2 where a in (Load a resident Table1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried some solutions, but still not success. An examble:&lt;/P&gt;&lt;P&gt;Table1:&lt;/P&gt;&lt;P&gt;Load *;&lt;/P&gt;&lt;P&gt;SQL select a,b,c from datasource1 ;&lt;/P&gt;&lt;P&gt;let vListA = Concat(a, ',') ; // Always return NULL&lt;/P&gt;&lt;P&gt;Table 2:&lt;/P&gt;&lt;P&gt;Load *&lt;U&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;SQL select a,e,f from datasource2 where a in ('$(vListA)');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 19:20:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Sub-load-in-a-sql-select/m-p/1663513#M49873</guid>
      <dc:creator>thi_pham</dc:creator>
      <dc:date>2024-11-16T19:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: Sub load in a sql select</title>
      <link>https://community.qlik.com/t5/App-Development/Sub-load-in-a-sql-select/m-p/1663514#M49874</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/5747"&gt;@thi_pham&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;What you've tried should work if you get rid of the quotes around your variable. If you search community for "Dynamic SQL Query" you'll find examples.&lt;/P&gt;&lt;P&gt;That said, in general terms it's usually quicker to load the whole source table and use a Keep statement to reduce the result to what you want very quickly (note you might find that "keep" performs better than using "exists" if your data model allows). It depends on a whole host of factors such as the speed of your database, how your table is indexed, the resources available to Qlik server etc etc, but the in-memory database of Qlik doesn't have the transaction management overheads of a RDBMS and will usually be much faster. You'll need to test for your specific scenario to know for sure.&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Rod&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2020 03:59:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Sub-load-in-a-sql-select/m-p/1663514#M49874</guid>
      <dc:creator>Rodj</dc:creator>
      <dc:date>2020-01-08T03:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: Sub load in a sql select</title>
      <link>https://community.qlik.com/t5/App-Development/Sub-load-in-a-sql-select/m-p/1663516#M49875</link>
      <description>&lt;P&gt;Thanks so much&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/88402"&gt;@Rodj&lt;/a&gt;&amp;nbsp;for your information. It works now, I change 2 points:&lt;/P&gt;&lt;P&gt;Table1:&lt;/P&gt;&lt;P&gt;Load *;&lt;/P&gt;&lt;P&gt;SQL select a,b,c from datasource1 ;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;[temp]:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Load distinct concat(a, ',') as ValueLists resident&amp;nbsp;Table1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;let vListA = peek('ValueLists',0,'temp'); // It have values this way&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Table 2:&lt;/P&gt;&lt;P&gt;Load *&lt;U&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;SQL select a,e,f from datasource2 where a in &lt;STRONG&gt;($(vListA)); // As you mentioned&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2020 04:25:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Sub-load-in-a-sql-select/m-p/1663516#M49875</guid>
      <dc:creator>thi_pham</dc:creator>
      <dc:date>2020-01-08T04:25:40Z</dc:date>
    </item>
  </channel>
</rss>

