<?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: My &amp;quot;ORDER BY&amp;quot; on a resident table doesn't work in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476757#M686153</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Very weird, because without DISTINCT clause your script loads sorted right.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Jan 2014 16:37:42 GMT</pubDate>
    <dc:creator>Clever_Anjos</dc:creator>
    <dc:date>2014-01-07T16:37:42Z</dc:date>
    <item>
      <title>My "ORDER BY" on a resident table doesn't work</title>
      <link>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476755#M686151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to get the value before the last in a specific field, in QlikView script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the code I use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;Data:&lt;/P&gt;
&lt;P&gt;LOAD * INLINE [&lt;/P&gt;
&lt;P&gt;YearMonth&lt;/P&gt;
&lt;P&gt;201312&lt;/P&gt;
&lt;P&gt;201312&lt;/P&gt;
&lt;P&gt;201306&lt;/P&gt;
&lt;P&gt;201307&lt;/P&gt;
&lt;P&gt;201308&lt;/P&gt;
&lt;P&gt;201309&lt;/P&gt;
&lt;P&gt;201310&lt;/P&gt;
&lt;P&gt;201311&lt;/P&gt;
&lt;P&gt;201311&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;OrderBy:&lt;/P&gt;
&lt;P&gt;LOAD &lt;/P&gt;
&lt;P&gt;DISTINCT YearMonth AS TMP_date&lt;/P&gt;
&lt;P&gt;RESIDENT Data&lt;/P&gt;
&lt;P&gt;ORDER BY YearMonth DESC;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;LET vValue = peek('TMP_date', 1, 'OrderBy'); // 1 = peek the 2nd value.&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This script returns:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="2014-01-07_165650.png" class="jive-image" src="https://community.qlik.com/legacyfs/online/51173_2014-01-07_165650.png" style="width: 620px; height: 400px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and my variable is "201306", whereas it should be "201311".&lt;/P&gt;&lt;P&gt;--&amp;gt; the ORDER BY don't make sense.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Could you explain me why?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use the following workaround:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;OrderBy:&lt;/P&gt;
&lt;P&gt;LOAD &lt;/P&gt;
&lt;P&gt;DISTINCT YearMonth AS TMP_date&lt;/P&gt;
&lt;P&gt;RESIDENT Data&lt;/P&gt;
&lt;P&gt;ORDER BY YearMonth ASC;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;OrderBy2:&lt;/P&gt;
&lt;P&gt;LOAD &lt;/P&gt;
&lt;P&gt;DISTINCT TMP_date AS TMP_date2&lt;/P&gt;
&lt;P&gt;RESIDENT OrderBy&lt;/P&gt;
&lt;P&gt;ORDER BY TMP_date DESC;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;LET vValue = peek('TMP_date2', 1, 'OrderBy2');&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;It works, but it's not "clean".&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jan 2014 16:29:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476755#M686151</guid>
      <dc:creator>nicolas_martin</dc:creator>
      <dc:date>2014-01-07T16:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: My "ORDER BY" on a resident table doesn't work</title>
      <link>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476756#M686152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What about:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;Data:&lt;/P&gt;
&lt;P&gt;LOAD * INLINE [&lt;/P&gt;
&lt;P&gt;YearMonth&lt;/P&gt;
&lt;P&gt;201312&lt;/P&gt;
&lt;P&gt;201312&lt;/P&gt;
&lt;P&gt;201306&lt;/P&gt;
&lt;P&gt;201307&lt;/P&gt;
&lt;P&gt;201308&lt;/P&gt;
&lt;P&gt;201309&lt;/P&gt;
&lt;P&gt;201310&lt;/P&gt;
&lt;P&gt;201311&lt;/P&gt;
&lt;P&gt;201311&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Max:&lt;/P&gt;
&lt;P&gt;LOAD max(YearMonth, 2) as Max2YearMonth&lt;/P&gt;
&lt;P&gt;RESIDENT Data;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;LET vValue = peek('Max2YearMonth');&lt;/P&gt;

&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jan 2014 16:35:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476756#M686152</guid>
      <dc:creator>Nicole-Smith</dc:creator>
      <dc:date>2014-01-07T16:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: My "ORDER BY" on a resident table doesn't work</title>
      <link>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476757#M686153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Very weird, because without DISTINCT clause your script loads sorted right.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jan 2014 16:37:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476757#M686153</guid>
      <dc:creator>Clever_Anjos</dc:creator>
      <dc:date>2014-01-07T16:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: My "ORDER BY" on a resident table doesn't work</title>
      <link>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476758#M686154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not looking for a workaround, I'm looking for an explanation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you anyway, your workaround is more elegant than mine!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jan 2014 16:41:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476758#M686154</guid>
      <dc:creator>nicolas_martin</dc:creator>
      <dc:date>2014-01-07T16:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: My "ORDER BY" on a resident table doesn't work</title>
      <link>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476759#M686155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since an ascending sort works, I would consider this as a bug in the software.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jan 2014 17:04:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476759#M686155</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2014-01-07T17:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: My "ORDER BY" on a resident table doesn't work</title>
      <link>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476760#M686157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's my shot at an explanation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While the Help states:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Bold"&gt;&amp;nbsp; "distinct&lt;/SPAN&gt; is a predicate used if only the first of duplicate records should be loaded...",&lt;/P&gt;&lt;P&gt;I think in practice&lt;/P&gt;&lt;P&gt;DISTINCT is performed against the output table at the end of the load. It apparently does not preserve the input order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The help for Order By states:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Italic"&gt;&amp;nbsp; "order by&lt;/SPAN&gt; is a clause used for sorting the records of a resident table before they are processed by the &lt;SPAN class="Bold"&gt;load&lt;/SPAN&gt; statement."&lt;/P&gt;&lt;P&gt;Order By sets the order of the input table, it says nothing about controlling the order of the output table. It's just coincidental that if you write out without distinct (or potentially other operators), you get the same order by in the output. But I don't think it's part of the contract.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jan 2014 17:07:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476760#M686157</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2014-01-07T17:07:12Z</dc:date>
    </item>
    <item>
      <title>Re: My "ORDER BY" on a resident table doesn't work</title>
      <link>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476761#M686158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ASC doesn't work either.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With this data, it works, but add a simple line above, it doesn't:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;Data:&lt;/P&gt;
&lt;P&gt;LOAD * INLINE [&lt;/P&gt;
&lt;P&gt;YearMonth&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;201306&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;201312&lt;/P&gt;
&lt;P&gt;201312&lt;/P&gt;
&lt;P&gt;201306&lt;/P&gt;
&lt;P&gt;201307&lt;/P&gt;
&lt;P&gt;201308&lt;/P&gt;
&lt;P&gt;201309&lt;/P&gt;
&lt;P&gt;201310&lt;/P&gt;
&lt;P&gt;201311&lt;/P&gt;
&lt;P&gt;201311&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;OrderBy:&lt;/P&gt;
&lt;P&gt;LOAD &lt;/P&gt;
&lt;P&gt;DISTINCT YearMonth AS TMP_date&lt;/P&gt;
&lt;P&gt;RESIDENT Data&lt;/P&gt;
&lt;P&gt;ORDER BY YearMonth ASC;&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jan 2014 17:15:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476761#M686158</guid>
      <dc:creator>nicolas_martin</dc:creator>
      <dc:date>2014-01-07T17:15:55Z</dc:date>
    </item>
    <item>
      <title>Re: My "ORDER BY" on a resident table doesn't work</title>
      <link>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476762#M686159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since you looking for explanations, I think my explanations would still be: It's a defect in the software.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just for fun, here is another workaround:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OrderBy:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;YearMonth AS TMP_date&lt;/P&gt;&lt;P&gt;RESIDENT Data WHERE NOT EXISTS(TMP_date,YearMonth)&lt;/P&gt;&lt;P&gt;ORDER BY YearMonth DESC;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jan 2014 17:28:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476762#M686159</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2014-01-07T17:28:41Z</dc:date>
    </item>
    <item>
      <title>Re: My "ORDER BY" on a resident table doesn't work</title>
      <link>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476763#M686160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rob,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you're right, since even&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data:&lt;/P&gt;&lt;P&gt;LOAD DISTINCT * INLINE [&lt;/P&gt;&lt;P&gt;YearMonth&lt;/P&gt;&lt;P&gt;201306&lt;/P&gt;&lt;P&gt;201306&lt;/P&gt;&lt;P&gt;201307&lt;/P&gt;&lt;P&gt;201308&lt;/P&gt;&lt;P&gt;201309&lt;/P&gt;&lt;P&gt;201310&lt;/P&gt;&lt;P&gt;201311&lt;/P&gt;&lt;P&gt;201311&lt;/P&gt;&lt;P&gt;201312&lt;/P&gt;&lt;P&gt;201312&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;corrupts the order. Would be interesting to know why, though.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jan 2014 17:48:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476763#M686160</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2014-01-07T17:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: My "ORDER BY" on a resident table doesn't work</title>
      <link>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476764#M686161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-users/23088"&gt;Rob Wunderlich&lt;/A&gt;'s answer is closest.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;The ORDER BY is done &lt;SPAN style="text-decoration: underline;"&gt;&lt;EM&gt;before&lt;/EM&gt;&lt;/SPAN&gt; the table is loaded; on the input data. (Not the same as in SQL.)&lt;/LI&gt;&lt;LI&gt;The DISTINCT is applied &lt;EM style="text-decoration: underline;"&gt;after&lt;/EM&gt; the table is loaded; on the output data.&lt;/LI&gt;&lt;LI&gt;The DISTINCT can potentially affect the order of the records. (And does in most cases.)&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hence, a Load statement with both ORDER BY and DISTINCT may still come out un-ordered.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I agree that this may seem counter-intuitive, but it is difficult to change. And further, I am not sure it is theoretically possible: Sorting &lt;EM&gt;after&lt;/EM&gt; the DISTINCT is not possible since the DISTINCT is applied not only on the current table, but all tables that are concatenated with the current one - whereas ORDER BY only affects the current table. Further, the DISTINCT is based on the &lt;EM&gt;output&lt;/EM&gt; fields, whereas the ORDER BY is based on the &lt;EM&gt;input&lt;/EM&gt; fields - and the two sets need not have any fields in common...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No, I would say that &lt;A href="https://community.qlik.com/qlik-users/23088"&gt;Rob Wunderlich&lt;/A&gt; is spot on when he says that it is not "part of the contract".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jan 2014 12:54:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476764#M686161</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2014-01-09T12:54:47Z</dc:date>
    </item>
    <item>
      <title>Re: My "ORDER BY" on a resident table doesn't work</title>
      <link>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476765#M686163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Henric,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am just wondering, while QV has a quite efficient implementation for &lt;EM&gt;where not exists, &lt;/EM&gt;why this should potentially not be used also internally for the LOAD DISTINCT mechanism (of course you would need to build something like a composite key of all field values in a record to get distinct records). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know that the &lt;EM&gt;where&lt;/EM&gt; clause works on the input records, but I believe potentially, the same &lt;EM&gt;exists()&lt;/EM&gt; mechanism could work also on the output table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This should / could preserve input order (as I think it does in my above sample).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure if I made myself clear or I am missing something here, it's not my day today.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S: And now to something (not) completely different:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Help says: "&lt;SPAN class="Bold"&gt;distinct&lt;/SPAN&gt; is a predicate used if only the&lt;EM&gt; first of duplicate records&lt;/EM&gt; should be loaded."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the context of our contract, what does &lt;EM&gt;first of &lt;/EM&gt;mean here?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jan 2014 13:13:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476765#M686163</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2014-01-09T13:13:28Z</dc:date>
    </item>
    <item>
      <title>Re: My "ORDER BY" on a resident table doesn't work</title>
      <link>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476766#M686165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;intresting thread !!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;anant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jan 2014 13:14:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476766#M686165</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-01-09T13:14:01Z</dc:date>
    </item>
    <item>
      <title>Re: My "ORDER BY" on a resident table doesn't work</title>
      <link>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476767#M686170</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;true i have checked it HIC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That means in you can not load Distinct items straight with order by asc/desc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;first kiss all records and then kiss good bye either swehul where not exist or some other work around??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but any any it will burden&amp;nbsp; a qvw once with duplicate records..is i m missing something or something is left to be understood by me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;anant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jan 2014 13:44:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476767#M686170</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-01-09T13:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: My "ORDER BY" on a resident table doesn't work</title>
      <link>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476768#M686171</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, a work-around using where not Exists() is certainly feasible. And it would preserve the order. But it might be slower than DISTINCT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Concerning "first of duplicate records". I am probably responsible for those words in the documentation many years ago...&lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt; The algorithm for DISTINCT involves re-sorting the values and removing duplicates, and whether it really is the first value that is kept or not, I don't know. And it is really not relevant since the values are identical.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jan 2014 13:48:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476768#M686171</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2014-01-09T13:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: My "ORDER BY" on a resident table doesn't work</title>
      <link>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476769#M686172</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You right that you cannot have DISTINCT and ORDER BY in the same Load statement and expect a sorted table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But, there are many simple work-arounds.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Use DISTINCT in a first Load statement and the ORDER BY in a second - and the final table will be sorted. Note that if Nicolas had used DISTINCT in the inline Load instead, there would be no problem.&lt;/LI&gt;&lt;LI&gt;Use DISTINCT and ORDER BY in the same Load - and &lt;SPAN style="text-decoration: underline;"&gt;&lt;EM&gt;the Symbol table will be sorted&lt;/EM&gt;&lt;/SPAN&gt; (used for "Sort by Load order")&lt;/LI&gt;&lt;LI&gt;Use Where Not Exists() instead of DISTINCT.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jan 2014 14:12:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476769#M686172</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2014-01-09T14:12:49Z</dc:date>
    </item>
    <item>
      <title>Re: My "ORDER BY" on a resident table doesn't work</title>
      <link>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476770#M686173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Noted. Thanks HIC !!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ANANT&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jan 2014 05:42:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476770#M686173</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-01-10T05:42:10Z</dc:date>
    </item>
    <item>
      <title>Re: My "ORDER BY" on a resident table doesn't work</title>
      <link>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476771#M686174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;QlikView support says that's not a bug (it's a feature &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/grin.png" /&gt;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In order to be "modified" (not "corrected"), I had to create an idea and wait until there is enought vote so that the developpers think about it:&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/ideas/3272" style="font-size: 10pt; line-height: 1.5em;"&gt;http://community.qlik.com/ideas/3272&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jan 2014 08:50:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/My-quot-ORDER-BY-quot-on-a-resident-table-doesn-t-work/m-p/476771#M686174</guid>
      <dc:creator>nicolas_martin</dc:creator>
      <dc:date>2014-01-21T08:50:09Z</dc:date>
    </item>
  </channel>
</rss>

