<?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: Filter a SQL query with the result of another query in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Filter-a-SQL-query-with-the-result-of-another-query/m-p/387086#M696979</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes that's possible. Something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ExcelTable:&lt;/P&gt;&lt;P&gt;Load concat(distinct CustomerID, ',') as IDlist&lt;/P&gt;&lt;P&gt;from &lt;EM&gt;...myexcelfile...;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vIDlist = peek('IDlist');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SqlTable:&lt;/P&gt;&lt;P&gt;Select * from MyTable&lt;/P&gt;&lt;P&gt;where CustomerID in ($(vIDlist));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your customer id's are strings you need to change the concat to create single quotes:&lt;/P&gt;&lt;P&gt;concat(distinct chr(39) &amp;amp; CustomerID &amp;amp; chr(39), ',') as IDlist&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Feb 2013 10:03:47 GMT</pubDate>
    <dc:creator>Gysbert_Wassenaar</dc:creator>
    <dc:date>2013-02-27T10:03:47Z</dc:date>
    <item>
      <title>Filter a SQL query with the result of another query</title>
      <link>https://community.qlik.com/t5/QlikView/Filter-a-SQL-query-with-the-result-of-another-query/m-p/387085#M696978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Qlikview Script, is it possible to filter a SQL query based on the result of another query ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example : &lt;/P&gt;&lt;P&gt;if i load a Excel file with a column CustomerID (and 5 values), is it possible to use these values in the Where of the next SQL query of the Script ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2013 09:17:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Filter-a-SQL-query-with-the-result-of-another-query/m-p/387085#M696978</guid>
      <dc:creator>fredericvillemi</dc:creator>
      <dc:date>2013-02-27T09:17:22Z</dc:date>
    </item>
    <item>
      <title>Re: Filter a SQL query with the result of another query</title>
      <link>https://community.qlik.com/t5/QlikView/Filter-a-SQL-query-with-the-result-of-another-query/m-p/387086#M696979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes that's possible. Something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ExcelTable:&lt;/P&gt;&lt;P&gt;Load concat(distinct CustomerID, ',') as IDlist&lt;/P&gt;&lt;P&gt;from &lt;EM&gt;...myexcelfile...;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vIDlist = peek('IDlist');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SqlTable:&lt;/P&gt;&lt;P&gt;Select * from MyTable&lt;/P&gt;&lt;P&gt;where CustomerID in ($(vIDlist));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your customer id's are strings you need to change the concat to create single quotes:&lt;/P&gt;&lt;P&gt;concat(distinct chr(39) &amp;amp; CustomerID &amp;amp; chr(39), ',') as IDlist&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2013 10:03:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Filter-a-SQL-query-with-the-result-of-another-query/m-p/387086#M696979</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-02-27T10:03:47Z</dc:date>
    </item>
  </channel>
</rss>

