<?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: Use variable in SQL statement in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Use-variable-in-SQL-statement/m-p/95809#M765822</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You cannot use Max() function directly in the variable... you will need to use Max() in a load statement and then peek its value into the variable... just like you would do for a master calendar script&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Jul 2018 12:30:58 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2018-07-17T12:30:58Z</dc:date>
    <item>
      <title>Use variable in SQL statement</title>
      <link>https://community.qlik.com/t5/QlikView/Use-variable-in-SQL-statement/m-p/95808#M765821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have to use variable in SQL. This variable fetch the max Date of a field (DH_START). So, when i perform my SQL query on Oracle, it works.&lt;/P&gt;&lt;P&gt;E.g the max date is 30/06/2018 23:52:00&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The part of my SQL query using this is :&lt;/P&gt;&lt;P&gt;WHERE DH_START &amp;gt;= TO_DATE('30/06/2018 23:52:00', 'DD/MM/YYYY HH24:MI:SS')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The target is that the same query works in my Qlikview SQL statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But, the following statement don't works:&lt;/P&gt;&lt;P&gt;WHERE DH_START &amp;gt; TO_DATE($(Max_DH_2),'DD/MM/YYYY HH24:MI:SS')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use :&lt;/P&gt;&lt;P&gt;SET Max_DH=max(DH_START);&lt;BR /&gt;SET Max_DH_2=chr(39)&amp;amp;$(Max_DH)&amp;amp;chr(39);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When i use $(Max_DH_2) in a text box, it returns&amp;nbsp; '30/06/2018 23:52:00'. So, $(Max_DH_2) should works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What i have missed?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-variable-in-SQL-statement/m-p/95808#M765821</guid>
      <dc:creator>sergio0592</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Use variable in SQL statement</title>
      <link>https://community.qlik.com/t5/QlikView/Use-variable-in-SQL-statement/m-p/95809#M765822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You cannot use Max() function directly in the variable... you will need to use Max() in a load statement and then peek its value into the variable... just like you would do for a master calendar script&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jul 2018 12:30:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-variable-in-SQL-statement/m-p/95809#M765822</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-07-17T12:30:58Z</dc:date>
    </item>
    <item>
      <title>Re: Use variable in SQL statement</title>
      <link>https://community.qlik.com/t5/QlikView/Use-variable-in-SQL-statement/m-p/95810#M765823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks it works&lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/cool.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jul 2018 14:15:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-variable-in-SQL-statement/m-p/95810#M765823</guid>
      <dc:creator>sergio0592</dc:creator>
      <dc:date>2018-07-17T14:15:42Z</dc:date>
    </item>
  </channel>
</rss>

