<?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: SQL select with left join or where clause in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/SQL-select-with-left-join-or-where-clause/m-p/66595#M606074</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be do an inner join.&lt;/P&gt;&lt;P&gt;Like load your excel sheet then &lt;/P&gt;&lt;P&gt;INNER JOIN&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SQL Select * From tablename;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Make sure your ID fieldname in your Excel sheet matches the ID fieldname in you SQL query. Like &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table1:&lt;/P&gt;&lt;P&gt;LOAD ID &lt;/P&gt;&lt;P&gt;From yourexcel; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INNER JOIN(Table1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SQL Select ID, Field2, Field3....&lt;/P&gt;&lt;P&gt;From yourSourceTable; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 Jun 2018 18:07:00 GMT</pubDate>
    <dc:creator>vishsaggi</dc:creator>
    <dc:date>2018-06-06T18:07:00Z</dc:date>
    <item>
      <title>SQL select with left join or where clause</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-select-with-left-join-or-where-clause/m-p/66593#M606071</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: Arial; font-size: 10.0pt;"&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Arial; font-size: 10.0pt;"&gt;I'm trying to load data from SQL server to qlikview based on a list of IDs provided. The list of IDs, for example (1,2,3,4,5) is in an excel spreadsheet, I wanted to do a where clause&amp;nbsp; or left join in the SQL &lt;STRONG&gt;select&lt;/STRONG&gt; statement such as select * from table A where ID in (1,2,3,4,5) or left joint ID&amp;nbsp; to only extract these data from SQL server. Because the data volume is huge, I don't want to extract everything from SQL then reduce what's loaded to qlikview in load statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Arial; font-size: 10.0pt;"&gt;Any idea how to achieve that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Arial; font-size: 10.0pt;"&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Arial; font-size: 10.0pt;"&gt;Yvonne&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2018 17:23:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-select-with-left-join-or-where-clause/m-p/66593#M606071</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-06-06T17:23:25Z</dc:date>
    </item>
    <item>
      <title>Re: SQL select with left join or where clause</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-select-with-left-join-or-where-clause/m-p/66594#M606072</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you could create a variable containing a string of your values and use that in your sql select? &lt;/P&gt;&lt;P&gt;(steps 2 and 3 are the tricky part) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Load excel containing ID&lt;/P&gt;&lt;P&gt;2. create temp table containing a concat() function : &lt;/P&gt;&lt;P&gt;temp: &lt;/P&gt;&lt;P&gt;Load &lt;/P&gt;&lt;P&gt;concat(distinct ID,',') as FieldValuesString&lt;/P&gt;&lt;P&gt;resident Excel; &lt;/P&gt;&lt;P&gt;3. create variable containing your values&lt;/P&gt;&lt;P&gt;let vIndexes = peek('FieldValuesString',0,'temp') ; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. use variable in where clause &lt;/P&gt;&lt;P&gt;Load *&lt;/P&gt;&lt;P&gt;; &lt;/P&gt;&lt;P&gt;sql select&lt;/P&gt;&lt;P&gt;* &lt;/P&gt;&lt;P&gt;from XXX&lt;/P&gt;&lt;P&gt;where ID in ('$(vIndexes)'); &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2018 17:30:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-select-with-left-join-or-where-clause/m-p/66594#M606072</guid>
      <dc:creator>mikaelsc</dc:creator>
      <dc:date>2018-06-06T17:30:05Z</dc:date>
    </item>
    <item>
      <title>Re: SQL select with left join or where clause</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-select-with-left-join-or-where-clause/m-p/66595#M606074</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be do an inner join.&lt;/P&gt;&lt;P&gt;Like load your excel sheet then &lt;/P&gt;&lt;P&gt;INNER JOIN&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SQL Select * From tablename;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Make sure your ID fieldname in your Excel sheet matches the ID fieldname in you SQL query. Like &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table1:&lt;/P&gt;&lt;P&gt;LOAD ID &lt;/P&gt;&lt;P&gt;From yourexcel; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INNER JOIN(Table1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SQL Select ID, Field2, Field3....&lt;/P&gt;&lt;P&gt;From yourSourceTable; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2018 18:07:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-select-with-left-join-or-where-clause/m-p/66595#M606074</guid>
      <dc:creator>vishsaggi</dc:creator>
      <dc:date>2018-06-06T18:07:00Z</dc:date>
    </item>
    <item>
      <title>Re: SQL select with left join or where clause</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-select-with-left-join-or-where-clause/m-p/66596#M606075</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Load Excel file ids.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Table1:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;LOAD ID&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;From yourexcel;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Then load other table&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Table 2:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;LOAD * &lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;FROM your sql&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;WHERE EXISTS(ID);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2018 18:11:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-select-with-left-join-or-where-clause/m-p/66596#M606075</guid>
      <dc:creator>dwforest</dc:creator>
      <dc:date>2018-06-06T18:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: SQL select with left join or where clause</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-select-with-left-join-or-where-clause/m-p/66597#M606077</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A small modification David, you cannot write like Load * From sql may be you can try using Preceding load like&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;LOAD *&lt;/P&gt;&lt;P&gt;Where Exists(ID);&lt;/P&gt;&lt;P&gt;SQL Select *&lt;/P&gt;&lt;P&gt;FROM SourceTableName;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2018 18:26:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-select-with-left-join-or-where-clause/m-p/66597#M606077</guid>
      <dc:creator>vishsaggi</dc:creator>
      <dc:date>2018-06-06T18:26:18Z</dc:date>
    </item>
    <item>
      <title>Re: SQL select with left join or where clause</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-select-with-left-join-or-where-clause/m-p/66598#M606078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sorry, your solutions still need to read full database tables. &lt;/P&gt;&lt;P&gt;using the variable trick will perform the filtering on select in the db (and thus improving perf) &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Jun 2018 17:14:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-select-with-left-join-or-where-clause/m-p/66598#M606078</guid>
      <dc:creator>mikaelsc</dc:creator>
      <dc:date>2018-06-17T17:14:35Z</dc:date>
    </item>
  </channel>
</rss>

