<?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 SQL Query translation in Qlikview scripting language in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/SQL-Query-translation-in-Qlikview-scripting-language/m-p/1180815#M883571</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am running SQL query in my Qlikview script as developed by ETL Team to create a Dashboard in my current project. I am facing very obvious issues of NULL records even when there are no NULL records in the database, so I replaced them using UNKNOWN. the count of records are accurate when I relaod the application but still I am not satisfied with the Script as I am bit confused while working on it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P. S. - I have never worked on SQL queries in Qlikview script before, that is why.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;here is my SQL query from my Project --&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;OLE DB connection string.&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;TABLENAME (a single table where all the fields are fetched directly):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Load FIELDS --- PRECEEDING&amp;nbsp; LOAD;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;SQL SELECT &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG&gt;&lt;EM style="text-decoration: underline;"&gt;--ALL THE ABOVE FIELDS IN SQL MANNER –&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;OL style="list-style-type: upper-alpha;"&gt;&lt;LI&gt;A.FIELD1 AS FIELD_1,&lt;/LI&gt;&lt;LI&gt;B.FIELD5 AS FIELD_5,&lt;/LI&gt;&lt;LI&gt;C.FIELD18 AS FIELD_7,&lt;/LI&gt;&lt;LI&gt;FIELD33 AS FIELD_10,&lt;/LI&gt;&lt;LI&gt;E.FIELD43 AS FIELD_21,&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;FROM “DATABASE”.DBO.” POL_DTL” A INNER JOIN “DATABASE”.DBO.”POL_LOC_DTL” B ON &lt;/P&gt;&lt;OL style="list-style-type: upper-alpha;"&gt;&lt;LI&gt;A.CYC_ID = B.CYC_ID &lt;/LI&gt;&lt;/OL&gt;&lt;P style="margin-bottom: .0001pt;"&gt;AND A.POL_NBR = B.POL_NBR &lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;AND A.REGION = B.REGION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; INNER JOIN “DATABASE”.DBO.”CODE_TBL” C ON &lt;/P&gt;&lt;OL style="list-style-type: upper-alpha;"&gt;&lt;LI&gt;B.CYC_ID = C.CYC_ID &lt;/LI&gt;&lt;/OL&gt;&lt;P style="margin-bottom: .0001pt;"&gt;AND B.CODE = C.CODE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;INNER JOIN “DATABASE”.DBO.”METRIC_SUM” D ON &lt;/P&gt;&lt;OL style="list-style-type: upper-alpha;"&gt;&lt;LI&gt;A.CYC_ID = D.CYC_ID&lt;/LI&gt;&lt;/OL&gt;&lt;P style="margin-bottom: .0001pt;"&gt;AND A.REGION = D.REGION&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;AND A.POL_NBR = D.POL_NBR&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;AND B.CODE = D.CODE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;LEFT JOIN “DATABASE”.DBO.”POL_LAYER” E&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;ON A.CYC_ID&amp;nbsp; =&amp;nbsp; E.CYC_ID AND LEFT(A.POL_NBR, CHARINDEX(‘&amp;nbsp;&amp;nbsp; ’,A.POL_NBR)-1) = E.POL_NBR&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;WHERE A.CYC_ID IN (1,2) AND B.CODE IN (11,22) AND B.REGION IN (CA,NY);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;STATUS:&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;SQL SELECT&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;ISNULL(L.CYC_ID, O.CYC_ID) CYC_ID,&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;ISNULL(L.POL_NBR, O.POL_NBR) POL_NBR,&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;EXPR_DT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CASE WHEN L.CYC_ID IS NOT NULL AND O.CYC_ID IS NOT NULL AND L.EXPR_DT &amp;gt; = O.EXPR_DT THEN L.EXPR_DT &lt;/P&gt;&lt;P style="margin-left: 1.5in; margin-bottom: .0001pt; text-indent: .5in;"&gt;WHEN L.CYC_ID IS NOT NULL AND O.CYC_ID IS NULL THEN L.EXPR_DT&lt;/P&gt;&lt;P style="margin-left: 1.5in; margin-bottom: .0001pt; text-indent: .5in;"&gt;WHEN L.CYC_ID IS NULL AND O.CYC_ID IS NOT NULLTHEN O.EXPR_DT&lt;/P&gt;&lt;P style="margin-left: 1.5in; margin-bottom: .0001pt; text-indent: .5in;"&gt;ELSE NULL END,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;ISNULL(L.REGION, O.REGION) REGION,&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;[STATUS]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CASE WHEN L.CYC_ID IS NOT NULL AND O.CYC_ID IS NOT NULL AND L.EXPR_DT &amp;gt; O.EXPR_DT THEN ‘RENEWED’&lt;/P&gt;&lt;P style="margin-left: 1.0in; margin-bottom: .0001pt; text-indent: .5in;"&gt;WHEN L.CYC_ID IS NOT NULL AND O.CYC_ID&amp;nbsp; IS NOT NULL AND L.EXPR_DT = O.EXPR-DT THEN ‘ACTIVE’&lt;/P&gt;&lt;P style="margin-left: 1.0in; margin-bottom: .0001pt; text-indent: .5in;"&gt;WHEN L.CYC_ID IS NOT NULL AND O.CYC_ID IS NULL THEN ‘NEW’&lt;/P&gt;&lt;P style="margin-left: 1.0in; margin-bottom: .0001pt; text-indent: .5in;"&gt;WHEN L.CYC_ID IS NULL AND O.CYC_ID IS NOT NULL THEN ‘EXPIRED’&lt;/P&gt;&lt;P style="margin-left: 1.0in; margin-bottom: .0001pt; text-indent: .5in;"&gt;ELSE ‘UNKNOWN’ END&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;FROM &lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;(SELECT CYC_ID , POL_NBR, EXPR_DT, REGION FROM DATABASE.DBO.POL_DTL WHERE&amp;nbsp; CYC_ID IN (1,2) AND CODE IN (11,22) AND REGION IN (CA,NY)) L&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;FULL OUTER JOIN&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;(SELECT CYC_ID , POL_NBR, EXPR_DT, REGION FROM DATABASE.DBO.POL_DTL WHERE&amp;nbsp; CYC_ID IN (1,2) AND CODE IN (11,22) AND REGION IN (CA,NY)) O&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;EM&gt;&lt;STRONG style="font-size: 12pt;"&gt;----------no join is specified here-----------------so these are separate table with joins in table viewer---&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG&gt; F TABLE : THIS IS A MASTER CALENDER TABLE&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;F.CYC ID &lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;F.EFF_DT&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;EM style="font-size: 13.3333px;"&gt;&lt;STRONG style="font-size: 12pt;"&gt;----------no join is specified here-----------------so these are separate table with joins in table viewer---&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;OLE DB CONNECTION STRING FOR NEW DATABASE&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG&gt;G TABLE : THIS IS A VIEW FROM ANOTHER DATABASE &lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG&gt;G.CYC_ID &lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG&gt;G.REGION&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;What do I need to do in here??&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Table A has almost 50,000 rows&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Table B has almost 60,00,000 rows&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Table C has 4 rows&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Table D has 20,000 rows&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Table E has 25,000 rows&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;I am pulling the data from QVDs. I have optimized them already.&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;I tried but script execution failed several times during Inner join for the 1st 5 tables. If I relaod A and B with Inner join its coming correct but when I take the whole code, QV fetches 0 records. Sometimes, the execution failed too. I ttried with Debug with Limited Load of 10 rows. So it is showing 0 as well.&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Please help. This is something easily critical.&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Thank you so much in advance. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-11-25T16:16:04Z</dc:date>
    <item>
      <title>SQL Query translation in Qlikview scripting language</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-Query-translation-in-Qlikview-scripting-language/m-p/1180815#M883571</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am running SQL query in my Qlikview script as developed by ETL Team to create a Dashboard in my current project. I am facing very obvious issues of NULL records even when there are no NULL records in the database, so I replaced them using UNKNOWN. the count of records are accurate when I relaod the application but still I am not satisfied with the Script as I am bit confused while working on it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P. S. - I have never worked on SQL queries in Qlikview script before, that is why.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;here is my SQL query from my Project --&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;OLE DB connection string.&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;TABLENAME (a single table where all the fields are fetched directly):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Load FIELDS --- PRECEEDING&amp;nbsp; LOAD;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;SQL SELECT &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG&gt;&lt;EM style="text-decoration: underline;"&gt;--ALL THE ABOVE FIELDS IN SQL MANNER –&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;OL style="list-style-type: upper-alpha;"&gt;&lt;LI&gt;A.FIELD1 AS FIELD_1,&lt;/LI&gt;&lt;LI&gt;B.FIELD5 AS FIELD_5,&lt;/LI&gt;&lt;LI&gt;C.FIELD18 AS FIELD_7,&lt;/LI&gt;&lt;LI&gt;FIELD33 AS FIELD_10,&lt;/LI&gt;&lt;LI&gt;E.FIELD43 AS FIELD_21,&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;FROM “DATABASE”.DBO.” POL_DTL” A INNER JOIN “DATABASE”.DBO.”POL_LOC_DTL” B ON &lt;/P&gt;&lt;OL style="list-style-type: upper-alpha;"&gt;&lt;LI&gt;A.CYC_ID = B.CYC_ID &lt;/LI&gt;&lt;/OL&gt;&lt;P style="margin-bottom: .0001pt;"&gt;AND A.POL_NBR = B.POL_NBR &lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;AND A.REGION = B.REGION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; INNER JOIN “DATABASE”.DBO.”CODE_TBL” C ON &lt;/P&gt;&lt;OL style="list-style-type: upper-alpha;"&gt;&lt;LI&gt;B.CYC_ID = C.CYC_ID &lt;/LI&gt;&lt;/OL&gt;&lt;P style="margin-bottom: .0001pt;"&gt;AND B.CODE = C.CODE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;INNER JOIN “DATABASE”.DBO.”METRIC_SUM” D ON &lt;/P&gt;&lt;OL style="list-style-type: upper-alpha;"&gt;&lt;LI&gt;A.CYC_ID = D.CYC_ID&lt;/LI&gt;&lt;/OL&gt;&lt;P style="margin-bottom: .0001pt;"&gt;AND A.REGION = D.REGION&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;AND A.POL_NBR = D.POL_NBR&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;AND B.CODE = D.CODE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;LEFT JOIN “DATABASE”.DBO.”POL_LAYER” E&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;ON A.CYC_ID&amp;nbsp; =&amp;nbsp; E.CYC_ID AND LEFT(A.POL_NBR, CHARINDEX(‘&amp;nbsp;&amp;nbsp; ’,A.POL_NBR)-1) = E.POL_NBR&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;WHERE A.CYC_ID IN (1,2) AND B.CODE IN (11,22) AND B.REGION IN (CA,NY);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;STATUS:&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;SQL SELECT&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;ISNULL(L.CYC_ID, O.CYC_ID) CYC_ID,&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;ISNULL(L.POL_NBR, O.POL_NBR) POL_NBR,&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;EXPR_DT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CASE WHEN L.CYC_ID IS NOT NULL AND O.CYC_ID IS NOT NULL AND L.EXPR_DT &amp;gt; = O.EXPR_DT THEN L.EXPR_DT &lt;/P&gt;&lt;P style="margin-left: 1.5in; margin-bottom: .0001pt; text-indent: .5in;"&gt;WHEN L.CYC_ID IS NOT NULL AND O.CYC_ID IS NULL THEN L.EXPR_DT&lt;/P&gt;&lt;P style="margin-left: 1.5in; margin-bottom: .0001pt; text-indent: .5in;"&gt;WHEN L.CYC_ID IS NULL AND O.CYC_ID IS NOT NULLTHEN O.EXPR_DT&lt;/P&gt;&lt;P style="margin-left: 1.5in; margin-bottom: .0001pt; text-indent: .5in;"&gt;ELSE NULL END,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;ISNULL(L.REGION, O.REGION) REGION,&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;[STATUS]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CASE WHEN L.CYC_ID IS NOT NULL AND O.CYC_ID IS NOT NULL AND L.EXPR_DT &amp;gt; O.EXPR_DT THEN ‘RENEWED’&lt;/P&gt;&lt;P style="margin-left: 1.0in; margin-bottom: .0001pt; text-indent: .5in;"&gt;WHEN L.CYC_ID IS NOT NULL AND O.CYC_ID&amp;nbsp; IS NOT NULL AND L.EXPR_DT = O.EXPR-DT THEN ‘ACTIVE’&lt;/P&gt;&lt;P style="margin-left: 1.0in; margin-bottom: .0001pt; text-indent: .5in;"&gt;WHEN L.CYC_ID IS NOT NULL AND O.CYC_ID IS NULL THEN ‘NEW’&lt;/P&gt;&lt;P style="margin-left: 1.0in; margin-bottom: .0001pt; text-indent: .5in;"&gt;WHEN L.CYC_ID IS NULL AND O.CYC_ID IS NOT NULL THEN ‘EXPIRED’&lt;/P&gt;&lt;P style="margin-left: 1.0in; margin-bottom: .0001pt; text-indent: .5in;"&gt;ELSE ‘UNKNOWN’ END&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;FROM &lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;(SELECT CYC_ID , POL_NBR, EXPR_DT, REGION FROM DATABASE.DBO.POL_DTL WHERE&amp;nbsp; CYC_ID IN (1,2) AND CODE IN (11,22) AND REGION IN (CA,NY)) L&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;FULL OUTER JOIN&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;(SELECT CYC_ID , POL_NBR, EXPR_DT, REGION FROM DATABASE.DBO.POL_DTL WHERE&amp;nbsp; CYC_ID IN (1,2) AND CODE IN (11,22) AND REGION IN (CA,NY)) O&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;EM&gt;&lt;STRONG style="font-size: 12pt;"&gt;----------no join is specified here-----------------so these are separate table with joins in table viewer---&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG&gt; F TABLE : THIS IS A MASTER CALENDER TABLE&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;F.CYC ID &lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;F.EFF_DT&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;EM style="font-size: 13.3333px;"&gt;&lt;STRONG style="font-size: 12pt;"&gt;----------no join is specified here-----------------so these are separate table with joins in table viewer---&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;OLE DB CONNECTION STRING FOR NEW DATABASE&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG&gt;G TABLE : THIS IS A VIEW FROM ANOTHER DATABASE &lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG&gt;G.CYC_ID &lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG&gt;G.REGION&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;What do I need to do in here??&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Table A has almost 50,000 rows&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Table B has almost 60,00,000 rows&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Table C has 4 rows&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Table D has 20,000 rows&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Table E has 25,000 rows&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;I am pulling the data from QVDs. I have optimized them already.&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;I tried but script execution failed several times during Inner join for the 1st 5 tables. If I relaod A and B with Inner join its coming correct but when I take the whole code, QV fetches 0 records. Sometimes, the execution failed too. I ttried with Debug with Limited Load of 10 rows. So it is showing 0 as well.&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Please help. This is something easily critical.&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Thank you so much in advance. &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/SQL-Query-translation-in-Qlikview-scripting-language/m-p/1180815#M883571</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
  </channel>
</rss>

