<?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 script in qlikview in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/SQL-script-in-qlikview/m-p/1511275#M749952</link>
    <description>&lt;P&gt;Assuming that the SQL query you listed works, use the following&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Load&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;P_id,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;C_id,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;C_date,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;C_score;&lt;BR /&gt;SQL&amp;nbsp;SELECT t.P_id, t.C_id, t.C_date, t.C_score&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FROM temp t&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;INNER JOIN (SELECT P_id, C_id, Max(C_date) AS mdate, C_score&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FROM temp&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;WHERE C_date &amp;gt;= "2018-11-17" and C_date &amp;lt;= "2018-11-20"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GROUP BY P_id) AS a&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ON a.P_id = t.P_id AND a.mdate = t.C_date ;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If you want to change any field names in your Qlik model then use "as" (I made up an example below).&lt;BR /&gt;&lt;BR /&gt;Load&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;P_id as [Person ID],&lt;BR /&gt;&lt;BR /&gt;... etc.&lt;BR /&gt;&lt;BR /&gt;Don't forget the ";" after the load&amp;nbsp;statement and the SQL statement, or you'll get an error. Note that your "Select" statement is now&amp;nbsp;receded by the word "SQL".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Enjoy.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 22 Nov 2018 19:16:12 GMT</pubDate>
    <dc:creator>lblumenfeld</dc:creator>
    <dc:date>2018-11-22T19:16:12Z</dc:date>
    <item>
      <title>SQL script in qlikview</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-script-in-qlikview/m-p/1511267#M749951</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am new to qlikview please help me to implement below script in qlikview.&lt;/P&gt;&lt;P&gt;SELECT t.P_id, t.C_id, t.C_date, t.C_score&lt;BR /&gt;FROM temp t&lt;BR /&gt;INNER JOIN (SELECT P_id, C_id, Max(C_date) AS mdate, C_score&lt;BR /&gt;FROM temp&lt;BR /&gt;WHERE C_date &amp;gt;= "2018-11-17" and C_date &amp;lt;= "2018-11-20"&lt;BR /&gt;GROUP BY P_id) AS a&lt;BR /&gt;ON a.P_id = t.P_id AND a.mdate = t.C_date&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 05:09:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-script-in-qlikview/m-p/1511267#M749951</guid>
      <dc:creator>Santosh</dc:creator>
      <dc:date>2024-11-16T05:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: SQL script in qlikview</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-script-in-qlikview/m-p/1511275#M749952</link>
      <description>&lt;P&gt;Assuming that the SQL query you listed works, use the following&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Load&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;P_id,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;C_id,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;C_date,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;C_score;&lt;BR /&gt;SQL&amp;nbsp;SELECT t.P_id, t.C_id, t.C_date, t.C_score&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FROM temp t&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;INNER JOIN (SELECT P_id, C_id, Max(C_date) AS mdate, C_score&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FROM temp&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;WHERE C_date &amp;gt;= "2018-11-17" and C_date &amp;lt;= "2018-11-20"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GROUP BY P_id) AS a&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ON a.P_id = t.P_id AND a.mdate = t.C_date ;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If you want to change any field names in your Qlik model then use "as" (I made up an example below).&lt;BR /&gt;&lt;BR /&gt;Load&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;P_id as [Person ID],&lt;BR /&gt;&lt;BR /&gt;... etc.&lt;BR /&gt;&lt;BR /&gt;Don't forget the ";" after the load&amp;nbsp;statement and the SQL statement, or you'll get an error. Note that your "Select" statement is now&amp;nbsp;receded by the word "SQL".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Enjoy.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Nov 2018 19:16:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-script-in-qlikview/m-p/1511275#M749952</guid>
      <dc:creator>lblumenfeld</dc:creator>
      <dc:date>2018-11-22T19:16:12Z</dc:date>
    </item>
  </channel>
</rss>

