<?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 What is the difference between IN clause in SQL and exists in QlikView? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/What-is-the-difference-between-IN-clause-in-SQL-and-exists-in/m-p/355119#M1176732</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Perumal&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for responding me! Do you mean say that other than speed there is no other difference between them?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Attitude&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 17 Mar 2012 11:27:57 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-03-17T11:27:57Z</dc:date>
    <item>
      <title>What is the difference between IN clause in SQL and exists in QlikView?</title>
      <link>https://community.qlik.com/t5/QlikView/What-is-the-difference-between-IN-clause-in-SQL-and-exists-in/m-p/355115#M1176728</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;What is the difference between IN clause in SQL and exists in QlikView?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Attitude&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Mar 2012 17:41:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/What-is-the-difference-between-IN-clause-in-SQL-and-exists-in/m-p/355115#M1176728</guid>
      <dc:creator />
      <dc:date>2012-03-15T17:41:43Z</dc:date>
    </item>
    <item>
      <title>What is the difference between IN clause in SQL and exists in QlikView?</title>
      <link>https://community.qlik.com/t5/QlikView/What-is-the-difference-between-IN-clause-in-SQL-and-exists-in/m-p/355116#M1176729</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The IN clause in SQL is more like wildmatch in qlikview than exists.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;SQL:&lt;/P&gt;&lt;P&gt;Where Month IN ('Jan','Feb','Mar')&lt;/P&gt;&lt;P&gt;QV:&lt;/P&gt;&lt;P&gt;Where wildmatch(Month, 'Jan','Feb','Mar')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Exists is actually used more between tables in QlikView.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From the help section of QlikView about exists:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: bold;"&gt;exists(Month, 'Jan')&lt;SPAN style="font-weight: normal;"&gt;&lt;BR /&gt;returns -1 (true) if the field value &lt;/SPAN&gt;&lt;SPAN style="font-style: italic; font-weight: normal;"&gt;'Jan'&lt;/SPAN&gt;&lt;SPAN style="font-weight: normal;"&gt; is found in the current content of the field &lt;/SPAN&gt;&lt;SPAN style="font-style: italic; font-weight: normal;"&gt;Month.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: bold;"&gt;&lt;SPAN style="font-style: italic; font-weight: normal;"&gt;exists(IDnr, IDnr)&lt;/SPAN&gt;&lt;SPAN style="margin-left: 40px; font-weight: normal;"&gt;&lt;BR /&gt;returns -1 (true) if the value of the field IDnr in the current record already exists in any previously read record containing that field.&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: bold;"&gt;exists (IDnr)&lt;SPAN style="font-weight: normal;"&gt;&lt;BR /&gt;is identical to the previous example.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: bold;"&gt;&lt;SPAN style="font-weight: normal;"&gt;I most commonly use this for using calculations for Joins.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: bold;"&gt;&lt;SPAN style="font-weight: normal;"&gt;For instance you want every ID that is in table2 that is not in table1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Table1:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;ID&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table2:&lt;/P&gt;&lt;P&gt;NoConcatenate&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;ID&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;] WHERE NOT EXISTS(ID);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;drop table Table1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Normally in SQL you would do something to the extent of Table1.ID &amp;lt;&amp;gt; Table2.ID&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But in Qlikview you would have to include a where not exists clause as shown in the above example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This would give you ID's 3 and 4 only from Table 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Mar 2012 20:51:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/What-is-the-difference-between-IN-clause-in-SQL-and-exists-in/m-p/355116#M1176729</guid>
      <dc:creator />
      <dc:date>2012-03-15T20:51:04Z</dc:date>
    </item>
    <item>
      <title>What is the difference between IN clause in SQL and exists in QlikView?</title>
      <link>https://community.qlik.com/t5/QlikView/What-is-the-difference-between-IN-clause-in-SQL-and-exists-in/m-p/355117#M1176730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bapperson&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for responding to me. I am able to understand the what is IN and what is EXISTS. But still I am not able to to understand the difference between. Also I would like to know when we should be using IN and when we should be using EXISTS. Please explain!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Attitude&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Mar 2012 06:20:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/What-is-the-difference-between-IN-clause-in-SQL-and-exists-in/m-p/355117#M1176730</guid>
      <dc:creator />
      <dc:date>2012-03-16T06:20:32Z</dc:date>
    </item>
    <item>
      <title>What is the difference between IN clause in SQL and exists in QlikView?</title>
      <link>https://community.qlik.com/t5/QlikView/What-is-the-difference-between-IN-clause-in-SQL-and-exists-in/m-p/355118#M1176731</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" href="https://community.qlik.com/people/rikabkothari" id="jive-2930320331136103175352"&gt;At titude&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if U are using IN Function in Sql ,reloading slow ,but using Exists function in sql or Qlikview Reloading Fast &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Perumal A&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Mar 2012 12:13:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/What-is-the-difference-between-IN-clause-in-SQL-and-exists-in/m-p/355118#M1176731</guid>
      <dc:creator>perumal_41</dc:creator>
      <dc:date>2012-03-16T12:13:46Z</dc:date>
    </item>
    <item>
      <title>What is the difference between IN clause in SQL and exists in QlikView?</title>
      <link>https://community.qlik.com/t5/QlikView/What-is-the-difference-between-IN-clause-in-SQL-and-exists-in/m-p/355119#M1176732</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Perumal&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for responding me! Do you mean say that other than speed there is no other difference between them?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Attitude&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Mar 2012 11:27:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/What-is-the-difference-between-IN-clause-in-SQL-and-exists-in/m-p/355119#M1176732</guid>
      <dc:creator />
      <dc:date>2012-03-17T11:27:57Z</dc:date>
    </item>
    <item>
      <title>What is the difference between IN clause in SQL and exists in QlikView?</title>
      <link>https://community.qlik.com/t5/QlikView/What-is-the-difference-between-IN-clause-in-SQL-and-exists-in/m-p/355120#M1176733</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Both functions work in basically the same way, limiting the rows returned from a query.&amp;nbsp; With a SQL 'IN' statement it is either a defined list (comma separated in single quotes) or a sub query (another SQL statement in brackets). With a QlikView EXISTS statement it is comparing existing QlikView data with the data being loaded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The biggest difference is that the SQL IN can only work on source data wheres the QlikView EXISTS can only work on QVD or Resident loads.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, from a performance perspective if you are loading from a QVD then EXISTS is the best route (and I often load from an INLINE table to then limit with an EXISTS) - a single EXISTS statement on a QVD load still allows it to load in an optimised fashion.&amp;nbsp; However, to use a QlikView EXISTS on a SQL table you would need to first load all rows into a temporary table and then do an EXISTS on a RESIDENT load.&amp;nbsp; This is obviously hugely inefficient as you are pulling rows from SQL that you do not require in your data model.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The best way to deal with this scenario is to use a SQL WHERE statement, perhaps using an IN and a comma separated list.&amp;nbsp; You could create the comma separate list in a variable by looping through all possible values in a QlikView field (using a loop and a PEEK statement) and building a string that can then be used in the SQL statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The golden rule for performance is not to pull more across the pipe from your database into QlikView to then be parsed.&amp;nbsp; The most common way that I see this happening is from using a SELECT * in SQL which is then limited down by a field list on the QlikView side.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that is helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://www.quickintelligence.co.uk/"&gt;http://www.quickintelligence.co.uk/&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 18 Mar 2012 23:42:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/What-is-the-difference-between-IN-clause-in-SQL-and-exists-in/m-p/355120#M1176733</guid>
      <dc:creator>stevedark</dc:creator>
      <dc:date>2012-03-18T23:42:35Z</dc:date>
    </item>
  </channel>
</rss>

