<?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 Translating SQL to QlikView joins in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Translating-SQL-to-QlikView-joins/m-p/224057#M76517</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I am unsure as to why you want to convert this to QlikView joins, why don't you simply execute a LOAD from the SQL statement?&lt;/P&gt;&lt;P&gt;Maybe I'm missing something.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 23 Oct 2009 22:58:47 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-10-23T22:58:47Z</dc:date>
    <item>
      <title>Translating SQL to QlikView joins</title>
      <link>https://community.qlik.com/t5/QlikView/Translating-SQL-to-QlikView-joins/m-p/224056#M76516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I defy you all to translate the following SQL query, which has run beautifully in my report for months, into the usual QlikView joins. I've basically wasted a work week trying to figure this out.&lt;/P&gt;&lt;P&gt;The work_items table is automated to delete work_items that are more than 3 weeks old to save space. However, management wants the report to gather historical work_items which will be saved elsewhere (actually in a qvw file on our server)&lt;/P&gt;&lt;P&gt;I'll spot you an already-loaded Work_Items resident table; you needn't work out the gory details of loading from a qvd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;Work_Items:&lt;BR /&gt;Load&lt;BR /&gt;id as wi_id,&lt;BR /&gt;customer_id,&lt;BR /&gt;loan_id,&lt;BR /&gt;type_cd,&lt;BR /&gt;created_on,&lt;BR /&gt;updated_on,&lt;BR /&gt;resolved_on&lt;BR /&gt;;&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;OK, here's the SQL code. It aggregates work_item data (filtered by type_cd) and groups by date. However business rules dictate that a work_item that is created on the created_on date must be counted for each day (inclusive) between its created_on date and the resolved_on date. All denorm_next_business_dates does is give us a mini-cartesian results set -- literally the only field in there that's useful is 'date'.&lt;/P&gt;&lt;P&gt;Yes, I know I'm bounding in the where clause by the last-two-weeks, but I'm trying to verify to myself that the numbers generated by QlikView joins will match those generated from the SQL joins. Once the QlikView join script works, we'll remove those artificial bounds and work over the entirety of work_items date range data.&lt;/P&gt;&lt;P style="font-style: italic"&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;WorkItemTmp:&lt;BR /&gt;SQL&lt;BR /&gt;SELECT&lt;BR /&gt;bd.date AS uni_date&lt;BR /&gt;, SUM (CASE WHEN wi.type_cd IN ('coll_30','coll_60') THEN 1 ELSE 0 END)&lt;BR /&gt;AS wi_out_call_count&lt;BR /&gt;, SUM (CASE WHEN wi.type_cd IN ('coll_90','coll_120') THEN 1 ELSE 0 END)&lt;BR /&gt;AS wi_late_bp_nc_count&lt;BR /&gt;, SUM (CASE WHEN wi.type_cd IN ('coll_90') THEN 1 ELSE 0 END)&lt;BR /&gt;AS wi_late_call_count&lt;BR /&gt;FROM work_items wi&lt;BR /&gt;LEFT JOIN denorm_next_business_dates bd ON&lt;BR /&gt;bd.date &amp;lt;= CAST(CASE WHEN wi.resolved_on IS NULL THEN current_date ELSE wi.resolved_on END AS DATE)&lt;BR /&gt;JOIN loans l ON l.id = wi.loan_id&lt;BR /&gt;WHERE wi.type_cd LIKE ('coll_%')&lt;BR /&gt;AND (bd.date &amp;gt;= CAST(wi.created_on AS DATE))&lt;BR /&gt;AND (bd.date &amp;gt;= current_date - 14)&lt;BR /&gt;AND (bd.date &amp;lt;= current_date)&lt;BR /&gt;AND ((wi.created_on &amp;gt;= current_date - 14 AND wi.created_on &amp;lt;= current_date)&lt;BR /&gt;OR&lt;BR /&gt;(wi.created_on &amp;lt;= current_date AND wi.resolved_on IS NULL)&lt;BR /&gt;OR&lt;BR /&gt;(wi.resolved_on &amp;gt;= current_date - 14 AND wi.resolved_on &amp;lt;= current_date)&lt;BR /&gt;)&lt;BR /&gt;AND l.gov_law_state_cd &amp;lt;&amp;gt; 'WA'&lt;BR /&gt;AND ((wi.resolved_on IS NULL) OR (wi.resolved_on::TIME &amp;gt; '06:55:00'))&lt;BR /&gt;GROUP BY bd.date&lt;BR /&gt;ORDER BY bd.date&lt;BR /&gt;;&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt; &lt;H4&gt;&lt;/H4&gt;&lt;P&gt;Really folks I'm at my wit's end here. I honestly don't think this can be done with QlikView's loads/join syntax. Doesn't help that it's almost impossible to get your code to format well either.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Oct 2009 22:13:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Translating-SQL-to-QlikView-joins/m-p/224056#M76516</guid>
      <dc:creator />
      <dc:date>2009-10-23T22:13:51Z</dc:date>
    </item>
    <item>
      <title>Translating SQL to QlikView joins</title>
      <link>https://community.qlik.com/t5/QlikView/Translating-SQL-to-QlikView-joins/m-p/224057#M76517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I am unsure as to why you want to convert this to QlikView joins, why don't you simply execute a LOAD from the SQL statement?&lt;/P&gt;&lt;P&gt;Maybe I'm missing something.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Oct 2009 22:58:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Translating-SQL-to-QlikView-joins/m-p/224057#M76517</guid>
      <dc:creator />
      <dc:date>2009-10-23T22:58:47Z</dc:date>
    </item>
    <item>
      <title>Translating SQL to QlikView joins</title>
      <link>https://community.qlik.com/t5/QlikView/Translating-SQL-to-QlikView-joins/m-p/224058#M76518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nigel: ?You mean you can rig a SQL statement to use a qvw file instead of a typical table designation? ?How does one do that?&lt;/P&gt;&lt;P&gt;The point is that I won't be reading SOLELY from the SQL table Work_Items anymore. I'll be reading from both a qvw file as well as yesterday's Work_Item records from the database.&lt;/P&gt;&lt;P&gt;I know *I*'m missing something, I just don't know what...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Oct 2009 23:01:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Translating-SQL-to-QlikView-joins/m-p/224058#M76518</guid>
      <dc:creator />
      <dc:date>2009-10-23T23:01:18Z</dc:date>
    </item>
    <item>
      <title>Translating SQL to QlikView joins</title>
      <link>https://community.qlik.com/t5/QlikView/Translating-SQL-to-QlikView-joins/m-p/224059#M76519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No, unfortunately not, what I mean is you can create a QVW table direct from a SQL statement by something like:&lt;/P&gt;&lt;P&gt;QVW_TableName:&lt;/P&gt;&lt;P&gt;LOAD Customer,&lt;/P&gt;&lt;P&gt;SalesValue;&lt;/P&gt;&lt;P&gt;SQL SELECT Customer,&lt;/P&gt;&lt;P&gt;SUM(Sales)&lt;/P&gt;&lt;P&gt;FROM dbo.vw_sales&lt;/P&gt;&lt;P&gt;GROUP BY Customer&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;This is just an example, but it shows the principle of creating a table in the qvw load script, I am not sure what you need to do that is different to this.&lt;BR /&gt;Regards,&amp;lt;/body&amp;gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Oct 2009 23:07:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Translating-SQL-to-QlikView-joins/m-p/224059#M76519</guid>
      <dc:creator />
      <dc:date>2009-10-23T23:07:15Z</dc:date>
    </item>
    <item>
      <title>Translating SQL to QlikView joins</title>
      <link>https://community.qlik.com/t5/QlikView/Translating-SQL-to-QlikView-joins/m-p/224060#M76520</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, just saw your next reply.&lt;/P&gt;&lt;P&gt;I think you need to look at creating QVD files inside your load script, then you can concatenate the SQL data to your QVD file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Oct 2009 23:08:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Translating-SQL-to-QlikView-joins/m-p/224060#M76520</guid>
      <dc:creator />
      <dc:date>2009-10-23T23:08:18Z</dc:date>
    </item>
    <item>
      <title>Translating SQL to QlikView joins</title>
      <link>https://community.qlik.com/t5/QlikView/Translating-SQL-to-QlikView-joins/m-p/224061#M76521</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I get the impression that you want to load todays data and join that to an historical table that holds the remainder of the data, is this correct.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Oct 2009 23:12:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Translating-SQL-to-QlikView-joins/m-p/224061#M76521</guid>
      <dc:creator />
      <dc:date>2009-10-23T23:12:00Z</dc:date>
    </item>
    <item>
      <title>Translating SQL to QlikView joins</title>
      <link>https://community.qlik.com/t5/QlikView/Translating-SQL-to-QlikView-joins/m-p/224062#M76522</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah, yes sir, that's what, I believe, the documentation would call "Loading data from succeeding input table". Sadly, you can't refer to historical qvw data in that context as the SQL joins to QV resident tables or raw files always give you a syntax error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Oct 2009 23:14:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Translating-SQL-to-QlikView-joins/m-p/224062#M76522</guid>
      <dc:creator />
      <dc:date>2009-10-23T23:14:09Z</dc:date>
    </item>
    <item>
      <title>Translating SQL to QlikView joins</title>
      <link>https://community.qlik.com/t5/QlikView/Translating-SQL-to-QlikView-joins/m-p/224063#M76523</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Indeed it is, and oddly enough, THAT'S already been done and confirmed LOL. I generate a resident table which can be used for subsequent QlikView loads/joins/whatevers. This is the resident Work_Items table that I "spot" you in the above challenge. Sadly that resident table is totally useless to a SQL SELECT statement...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Oct 2009 23:16:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Translating-SQL-to-QlikView-joins/m-p/224063#M76523</guid>
      <dc:creator />
      <dc:date>2009-10-23T23:16:51Z</dc:date>
    </item>
    <item>
      <title>Translating SQL to QlikView joins</title>
      <link>https://community.qlik.com/t5/QlikView/Translating-SQL-to-QlikView-joins/m-p/224064#M76524</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, so here goes with a suggestion, this will be the last entry of the day for me because I'm off home (thank god).&lt;/P&gt;&lt;P&gt;Your first load creates a resident table (Work_Items), in your following SQL statement you should have something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Work_Items_Today:&lt;BR /&gt;Concatenate (Work_Items)&lt;BR /&gt;LOAD A,B,C;&lt;BR /&gt;SQL Select A,B,C FROM TABLENAME;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;This is a method I use all the time to join two tables together.&lt;/P&gt;&lt;P&gt;Hope it helps, but if not, have a great weekend and we'll work through something next week.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Oct 2009 23:23:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Translating-SQL-to-QlikView-joins/m-p/224064#M76524</guid>
      <dc:creator />
      <dc:date>2009-10-23T23:23:54Z</dc:date>
    </item>
    <item>
      <title>Translating SQL to QlikView joins</title>
      <link>https://community.qlik.com/t5/QlikView/Translating-SQL-to-QlikView-joins/m-p/224065#M76525</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, just as a note......&lt;/P&gt;&lt;P&gt;Your QlikView document will then only have Work_Items available as a table, the table Work_Items_Today will not exist as its just temporary.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Oct 2009 23:24:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Translating-SQL-to-QlikView-joins/m-p/224065#M76525</guid>
      <dc:creator />
      <dc:date>2009-10-23T23:24:56Z</dc:date>
    </item>
    <item>
      <title>Translating SQL to QlikView joins</title>
      <link>https://community.qlik.com/t5/QlikView/Translating-SQL-to-QlikView-joins/m-p/224066#M76526</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK I'll try it out. Thanks for the help Nigel; your weekend is guaranteed to be better than mine.&lt;/P&gt;&lt;P&gt;Btw: thank you for letting me know that the Work_Items_Today is temporary. The documentation sure doesn't tell me that, and I'd have no reason to think that table would NOT stay around.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Oct 2009 23:27:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Translating-SQL-to-QlikView-joins/m-p/224066#M76526</guid>
      <dc:creator />
      <dc:date>2009-10-23T23:27:39Z</dc:date>
    </item>
  </channel>
</rss>

