<?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 More fun with WHERE.... IN.... in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/More-fun-with-WHERE-IN/m-p/549885#M686787</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello fellow QlikView enthusiasts.&amp;nbsp; I have a SQL statement that I am really struggling with.&amp;nbsp; Would someone out there please re-write this exactly how it should be?&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="html" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13903997278514057" jivemacro_uid="_13903997278514057"&gt;
&lt;P&gt;SELECT sourcingclass_1.[AX PO#], sourcingclass_1.AX_Class, "Multiple_classes" AS Class_dup&lt;/P&gt;
&lt;P&gt;FROM sourcingclass_1&lt;/P&gt;
&lt;P&gt;WHERE (((sourcingclass_1.[AX PO#]) In (SELECT [AX PO#] FROM [sourcingclass_1] As Tmp GROUP BY [AX PO#] HAVING Count(*)&amp;gt;1 )))&lt;/P&gt;
&lt;P&gt;ORDER BY sourcingclass_1.[AX PO#];&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think I should be writing this as a WHERE EXISTS, but would really appreciate a clearly written final answer for myself and others as a reference.&amp;nbsp; Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Jan 2014 14:10:39 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2014-01-22T14:10:39Z</dc:date>
    <item>
      <title>More fun with WHERE.... IN....</title>
      <link>https://community.qlik.com/t5/QlikView/More-fun-with-WHERE-IN/m-p/549885#M686787</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello fellow QlikView enthusiasts.&amp;nbsp; I have a SQL statement that I am really struggling with.&amp;nbsp; Would someone out there please re-write this exactly how it should be?&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="html" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13903997278514057" jivemacro_uid="_13903997278514057"&gt;
&lt;P&gt;SELECT sourcingclass_1.[AX PO#], sourcingclass_1.AX_Class, "Multiple_classes" AS Class_dup&lt;/P&gt;
&lt;P&gt;FROM sourcingclass_1&lt;/P&gt;
&lt;P&gt;WHERE (((sourcingclass_1.[AX PO#]) In (SELECT [AX PO#] FROM [sourcingclass_1] As Tmp GROUP BY [AX PO#] HAVING Count(*)&amp;gt;1 )))&lt;/P&gt;
&lt;P&gt;ORDER BY sourcingclass_1.[AX PO#];&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think I should be writing this as a WHERE EXISTS, but would really appreciate a clearly written final answer for myself and others as a reference.&amp;nbsp; Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jan 2014 14:10:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/More-fun-with-WHERE-IN/m-p/549885#M686787</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-01-22T14:10:39Z</dc:date>
    </item>
    <item>
      <title>Re: More fun with WHERE.... IN....</title>
      <link>https://community.qlik.com/t5/QlikView/More-fun-with-WHERE-IN/m-p/549886#M686788</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can try below queries:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT sourcingclass_1.[AX PO#], sourcingclass_1.AX_Class, "Multiple_classes" AS Class_dup &lt;/P&gt;&lt;P&gt;FROM sourcingclass_1&lt;/P&gt;&lt;P&gt;join (SELECT [AX PO#] FROM sourcingclass_1 GROUP BY [AX PO#] HAVING Count(*)&amp;gt;1) test on sourcingclass_1.[AX PO#] = test.[AX PO#]&lt;/P&gt;&lt;P&gt;ORDER BY sourcingclass_1.[AX PO#];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; or you can use below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT sourcingclass_1.[AX PO#], sourcingclass_1.AX_Class, "Multiple_classes" AS Class_dup &lt;/P&gt;&lt;P&gt;FROM sourcingclass_1 &lt;/P&gt;&lt;P&gt;WHERE sourcingclass_1.[AX PO#] In (SELECT [AX PO#] FROM sourcingclass_1 GROUP BY [AX PO#] HAVING Count(*)&amp;gt;1)&lt;/P&gt;&lt;P&gt;ORDER BY sourcingclass_1.[AX PO#];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first one will be better since we are using join clause which is more performance oriented than Where clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Angad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jan 2014 17:08:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/More-fun-with-WHERE-IN/m-p/549886#M686788</guid>
      <dc:creator />
      <dc:date>2014-01-22T17:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: More fun with WHERE.... IN....</title>
      <link>https://community.qlik.com/t5/QlikView/More-fun-with-WHERE-IN/m-p/549887#M686789</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can simply use your sql statement to load the data you want into qlikview. Qlikview will simply send the sql statement to the dbms (or oledb/odbc driver) for execution and will load the records that are returned.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could also try this, which will be less efficient:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Temp:&lt;/P&gt;&lt;P&gt;LOAD &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;[AX PO#], if(exists(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;[AX PO#]&lt;/SPAN&gt;), &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt; [AX PO#]&lt;/SPAN&gt;) as &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;[AX PO#_2];&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;SELECT &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;[AX PO#] FROM sourcingclass_1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result:&lt;/P&gt;&lt;P&gt;LOAD * WHERE exists(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;[AX PO#_2]&lt;/SPAN&gt;,&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;sourcingclass_1.[AX PO#]&lt;/SPAN&gt;);&lt;/P&gt;&lt;P&gt;SELECT &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;sourcingclass_1.[AX PO#], sourcingclass_1.AX_Class, "Multiple_classes" AS Class_dup FROM sourcingclass_1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP table Temp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jan 2014 17:55:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/More-fun-with-WHERE-IN/m-p/549887#M686789</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2014-01-22T17:55:42Z</dc:date>
    </item>
    <item>
      <title>Re: More fun with WHERE.... IN....</title>
      <link>https://community.qlik.com/t5/QlikView/More-fun-with-WHERE-IN/m-p/549888#M686790</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Gysbert, my data is already in QlikView, so a SELECT statement will not work.&amp;nbsp; Any ideas on how to write this for data already in QlikView?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jan 2014 19:00:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/More-fun-with-WHERE-IN/m-p/549888#M686790</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-01-22T19:00:04Z</dc:date>
    </item>
    <item>
      <title>Re: More fun with WHERE.... IN....</title>
      <link>https://community.qlik.com/t5/QlikView/More-fun-with-WHERE-IN/m-p/549889#M686792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, assuming you already loaded the data into a table called sourcingclass and want a new table with only the [AX PO#] field values that have more than one related record in sourcingclass:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result:&lt;/P&gt;&lt;P&gt;load [AX PO#] where Count &amp;gt;1;&lt;/P&gt;&lt;P&gt;load [AX PO#], count([AX PO#]) as Count&lt;/P&gt;&lt;P&gt;resident sourcingclass&lt;/P&gt;&lt;P&gt;group by [AX PO#];&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jan 2014 20:50:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/More-fun-with-WHERE-IN/m-p/549889#M686792</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2014-01-22T20:50:47Z</dc:date>
    </item>
  </channel>
</rss>

