<?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: Equivalent of Exists from SQL in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Equivalent-of-Exists-from-SQL/m-p/1696156#M53243</link>
    <description>&lt;P&gt;Try something like this.&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="3"&gt;TA&lt;FONT color="#993300"&gt;NK_VISIT_IDs:&lt;/FONT&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3" color="#993300"&gt;LOAD&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3" color="#993300"&gt;&amp;nbsp; &amp;nbsp;VISIT_ID as TANK_VISIT_ID&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3" color="#993300"&gt;from SNAPSHOT.qvd&amp;nbsp; (qvd)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3" color="#993300"&gt;LANE = '1' and CARGO_TYPE = 'TANK';&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="3" color="#993300"&gt;LOW_CONF_VISIT_IDs:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3" color="#993300"&gt;LOAD&amp;nbsp; VISIT_ID as LOW_CONF_VISIT_ID&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3" color="#993300"&gt;from VISITLOG.qvd (qvd)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3" color="#993300"&gt;where &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3" color="#993300"&gt;&amp;nbsp; &amp;nbsp;SOURCE = 'IN'&amp;nbsp; and EVENT = 'LOW_CONF';&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="3"&gt;LOAD DISTINCT &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp; COUNT(VISIT_ID) as result1 &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;from VISIT.QVD&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;WHERE &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp; ATA &amp;gt;='2020-02-11 00:00:00' AND ATA &amp;lt;='2020-02-18 23:59:59' AND&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3" color="#993300"&gt;&amp;nbsp; Exists(TANK_VISIT_ID,VISIT_ID) AND&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3" color="#993300"&gt;&amp;nbsp; Exists(LOW_CONF_VISIT_ID, VISIT_ID) &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993300"&gt;&lt;FONT face="courier new,courier" size="3"&gt;DROP TABLE&amp;nbsp;TANK_VISIT_IDs;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;DROP TABLE LOW_CONF_VISIT_IDs;&lt;/FONT&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 23 Apr 2020 13:34:08 GMT</pubDate>
    <dc:creator>Vegar</dc:creator>
    <dc:date>2020-04-23T13:34:08Z</dc:date>
    <item>
      <title>Equivalent of Exists from SQL</title>
      <link>https://community.qlik.com/t5/App-Development/Equivalent-of-Exists-from-SQL/m-p/1696135#M53242</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I have inherited someones SQL and I am in the process of creating a QS App which would suit moving this piece of code into.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SELECT DISTINCT COUNT(VISIT_ID) as result1 from VISIT v
WHERE v.ATA BETWEEN '2020-02-11 00:00:00' AND '2020-02-18 23:59:59'
AND 
EXISTS (select VISIT_ID from SNAPSHOT s 
			where v.VISIT_ID = s.VISIT_ID
			and s.LANE = '1'
			and s.CARGO_TYPE = 'TANK')

AND 
EXISTS (select VISIT_ID from VISITLOG vl
			where v.VISIT_ID = vl.VISIT_ID
			and vl.SOURCE = 'IN'
			and vl.EVENT = 'LOW_CONF');&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;This returns a single value of 50.&lt;/P&gt;&lt;P&gt;I can do the equivalent of each sub-query in Qlik (I have all the raw tables,&amp;nbsp; a fact table and all joins are correct and working).&lt;/P&gt;&lt;P&gt;I am looking for some advice as to what is the best way to tackle something like the above in QlikSense.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 20 Dec 2021 21:08:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Equivalent-of-Exists-from-SQL/m-p/1696135#M53242</guid>
      <dc:creator>c_latham</dc:creator>
      <dc:date>2021-12-20T21:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: Equivalent of Exists from SQL</title>
      <link>https://community.qlik.com/t5/App-Development/Equivalent-of-Exists-from-SQL/m-p/1696156#M53243</link>
      <description>&lt;P&gt;Try something like this.&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="3"&gt;TA&lt;FONT color="#993300"&gt;NK_VISIT_IDs:&lt;/FONT&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3" color="#993300"&gt;LOAD&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3" color="#993300"&gt;&amp;nbsp; &amp;nbsp;VISIT_ID as TANK_VISIT_ID&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3" color="#993300"&gt;from SNAPSHOT.qvd&amp;nbsp; (qvd)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3" color="#993300"&gt;LANE = '1' and CARGO_TYPE = 'TANK';&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="3" color="#993300"&gt;LOW_CONF_VISIT_IDs:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3" color="#993300"&gt;LOAD&amp;nbsp; VISIT_ID as LOW_CONF_VISIT_ID&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3" color="#993300"&gt;from VISITLOG.qvd (qvd)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3" color="#993300"&gt;where &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3" color="#993300"&gt;&amp;nbsp; &amp;nbsp;SOURCE = 'IN'&amp;nbsp; and EVENT = 'LOW_CONF';&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="3"&gt;LOAD DISTINCT &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp; COUNT(VISIT_ID) as result1 &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;from VISIT.QVD&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;WHERE &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp; ATA &amp;gt;='2020-02-11 00:00:00' AND ATA &amp;lt;='2020-02-18 23:59:59' AND&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3" color="#993300"&gt;&amp;nbsp; Exists(TANK_VISIT_ID,VISIT_ID) AND&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3" color="#993300"&gt;&amp;nbsp; Exists(LOW_CONF_VISIT_ID, VISIT_ID) &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993300"&gt;&lt;FONT face="courier new,courier" size="3"&gt;DROP TABLE&amp;nbsp;TANK_VISIT_IDs;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;DROP TABLE LOW_CONF_VISIT_IDs;&lt;/FONT&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Apr 2020 13:34:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Equivalent-of-Exists-from-SQL/m-p/1696156#M53243</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2020-04-23T13:34:08Z</dc:date>
    </item>
  </channel>
</rss>

