<?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 Unexplainable SQL Result in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Unexplainable-SQL-Result/m-p/584627#M79049</link>
    <description>&lt;P&gt;I know!&amp;nbsp; SQL can be strange and throw up peculiar results at times, but this is really simple SQL with an allegedly simple result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I have is 3 tables.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table 1:&amp;nbsp; One column, which is a list of dates covering every day between 31.12.2019 and 31.12.2023.&lt;/P&gt;&lt;P&gt;Table 2:&amp;nbsp; Two columns:&amp;nbsp; Column 1 is the date of an event and column 2 is the count of the number of times the event occurred on the date in column 1.&lt;/P&gt;&lt;P&gt;Table 3:&amp;nbsp; &amp;nbsp;Two columns:&amp;nbsp; Column 1 is the date of a different event and column 2 is the count of the number of times the event occurred on the date in column 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to combine the three tables into a three-column table (date, occurrences of event 1, occurrences of event 2).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;SQL (it doesn't get much simpler)&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;SELECT t1.Date, t2."N Rows", t3."N Rows" AS "N Rows 2" 
FROM Date_to_2024  t1 
	LEFT OUTER JOIN QNs_Opened t2 
		ON  ( t1.Date = t2."Created On" )  
	LEFT OUTER JOIN QNs_Closed t3 
		ON  ( t1.Date = t3."Completn date" ) &lt;/CODE&gt;&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table 1:&amp;nbsp; (Plenty of Data occurring after 10/08/2021)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="peterrow_2-1671702106930.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/48612iF0AD45D9A0C34A16/image-size/medium?v=v2&amp;amp;px=400" role="button" title="peterrow_2-1671702106930.png" alt="peterrow_2-1671702106930.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Table 2:&amp;nbsp;&amp;nbsp; (Plenty of Data occurring after 10/08/2021)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="peterrow_3-1671702317343.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/48614iEC7454D200127984/image-size/medium?v=v2&amp;amp;px=400" role="button" title="peterrow_3-1671702317343.png" alt="peterrow_3-1671702317343.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Query Result&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="peterrow_1-1671701862769.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/48610iFDD6F1A37BBE6003/image-size/medium?v=v2&amp;amp;px=400" role="button" title="peterrow_1-1671701862769.png" alt="peterrow_1-1671701862769.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Data from table 1 ("Created on",&amp;nbsp; "N Rows 2") - Correct.&lt;/P&gt;&lt;P&gt;Data from table 2 ("Completn Date", "N Rows") - Correct until 10/08/2021, then no further data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried switching table 1 and table 2.&amp;nbsp; I've tried importing the data again and re-running the query.&amp;nbsp; I have recreated the query from scratch...no luck.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 10 Jun 2023 23:58:52 GMT</pubDate>
    <dc:creator>peterrow</dc:creator>
    <dc:date>2023-06-10T23:58:52Z</dc:date>
    <item>
      <title>Unexplainable SQL Result</title>
      <link>https://community.jmp.com/t5/Discussions/Unexplainable-SQL-Result/m-p/584627#M79049</link>
      <description>&lt;P&gt;I know!&amp;nbsp; SQL can be strange and throw up peculiar results at times, but this is really simple SQL with an allegedly simple result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I have is 3 tables.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table 1:&amp;nbsp; One column, which is a list of dates covering every day between 31.12.2019 and 31.12.2023.&lt;/P&gt;&lt;P&gt;Table 2:&amp;nbsp; Two columns:&amp;nbsp; Column 1 is the date of an event and column 2 is the count of the number of times the event occurred on the date in column 1.&lt;/P&gt;&lt;P&gt;Table 3:&amp;nbsp; &amp;nbsp;Two columns:&amp;nbsp; Column 1 is the date of a different event and column 2 is the count of the number of times the event occurred on the date in column 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to combine the three tables into a three-column table (date, occurrences of event 1, occurrences of event 2).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;SQL (it doesn't get much simpler)&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;SELECT t1.Date, t2."N Rows", t3."N Rows" AS "N Rows 2" 
FROM Date_to_2024  t1 
	LEFT OUTER JOIN QNs_Opened t2 
		ON  ( t1.Date = t2."Created On" )  
	LEFT OUTER JOIN QNs_Closed t3 
		ON  ( t1.Date = t3."Completn date" ) &lt;/CODE&gt;&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table 1:&amp;nbsp; (Plenty of Data occurring after 10/08/2021)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="peterrow_2-1671702106930.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/48612iF0AD45D9A0C34A16/image-size/medium?v=v2&amp;amp;px=400" role="button" title="peterrow_2-1671702106930.png" alt="peterrow_2-1671702106930.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Table 2:&amp;nbsp;&amp;nbsp; (Plenty of Data occurring after 10/08/2021)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="peterrow_3-1671702317343.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/48614iEC7454D200127984/image-size/medium?v=v2&amp;amp;px=400" role="button" title="peterrow_3-1671702317343.png" alt="peterrow_3-1671702317343.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Query Result&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="peterrow_1-1671701862769.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/48610iFDD6F1A37BBE6003/image-size/medium?v=v2&amp;amp;px=400" role="button" title="peterrow_1-1671701862769.png" alt="peterrow_1-1671701862769.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Data from table 1 ("Created on",&amp;nbsp; "N Rows 2") - Correct.&lt;/P&gt;&lt;P&gt;Data from table 2 ("Completn Date", "N Rows") - Correct until 10/08/2021, then no further data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried switching table 1 and table 2.&amp;nbsp; I've tried importing the data again and re-running the query.&amp;nbsp; I have recreated the query from scratch...no luck.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:58:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Unexplainable-SQL-Result/m-p/584627#M79049</guid>
      <dc:creator>peterrow</dc:creator>
      <dc:date>2023-06-10T23:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: Unexplainable SQL Result</title>
      <link>https://community.jmp.com/t5/Discussions/Unexplainable-SQL-Result/m-p/584657#M79052</link>
      <description>&lt;P&gt;Incidentally, I have solved the problem by using the "Join Table" function (Join two of the tables and then join the third to the result).&amp;nbsp; That worked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd like to know what is wrong with the SQL though!&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2022 10:21:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Unexplainable-SQL-Result/m-p/584657#M79052</guid>
      <dc:creator>peterrow</dc:creator>
      <dc:date>2022-12-22T10:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: Unexplainable SQL Result</title>
      <link>https://community.jmp.com/t5/Discussions/Unexplainable-SQL-Result/m-p/584794#M79064</link>
      <description>&lt;P&gt;Weird. If I run your exact query, I get what you're expecting. What version of JMP are you on?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Jed_Campbell_0-1671727642894.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/48642i354EDF0E7288E4FD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Jed_Campbell_0-1671727642894.png" alt="Jed_Campbell_0-1671727642894.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2022 16:48:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Unexplainable-SQL-Result/m-p/584794#M79064</guid>
      <dc:creator>Jed_Campbell</dc:creator>
      <dc:date>2022-12-22T16:48:02Z</dc:date>
    </item>
    <item>
      <title>Re: Unexplainable SQL Result</title>
      <link>https://community.jmp.com/t5/Discussions/Unexplainable-SQL-Result/m-p/584826#M79065</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/610"&gt;@Jed_Campbell&lt;/a&gt; you have to go more down, it is 10th of August 2021 when the issue occurs (or after it)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1671729628646.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/48645iFAA49835D95F25A1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1671729628646.png" alt="jthi_0-1671729628646.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I also tried checking with jmps datetime values and still the same issue&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1671729851434.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/48646i7D2F69660B76071B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1671729851434.png" alt="jthi_1-1671729851434.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="lia-link-navigation lia-attachment-link-disabled lia-link-disabled" aria-disabled="true"&gt;QNs_Closed.jmp&lt;/SPAN&gt; has one empty row, after removing it the query started working properly. No idea why.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_2-1671730033431.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/48647i9081591013BA7BAA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_2-1671730033431.png" alt="jthi_2-1671730033431.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_3-1671730077944.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/48648i8D33299EEEF4A4ED/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_3-1671730077944.png" alt="jthi_3-1671730077944.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;You can see this happening in the preview, create query with the row still there, build query, open review, delete the row and update preview&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2022 17:28:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Unexplainable-SQL-Result/m-p/584826#M79065</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-12-22T17:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: Unexplainable SQL Result</title>
      <link>https://community.jmp.com/t5/Discussions/Unexplainable-SQL-Result/m-p/584835#M79066</link>
      <description>&lt;P&gt;Well that&amp;nbsp;&lt;EM&gt;is&lt;/EM&gt; curious (and I duplicated it). I wonder why Aug 2021 is the date things go astray.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2022 17:50:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Unexplainable-SQL-Result/m-p/584835#M79066</guid>
      <dc:creator>Jed_Campbell</dc:creator>
      <dc:date>2022-12-22T17:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: Unexplainable SQL Result</title>
      <link>https://community.jmp.com/t5/Discussions/Unexplainable-SQL-Result/m-p/585036#M79076</link>
      <description>&lt;P&gt;Thanks for the help.&amp;nbsp; The empty line is expected in the data, but I could delete it with code before running the query.&amp;nbsp; I'm not sure that should be necessary though.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the future I'll keep an eye out for that but for now, two good and easy workarounds,&lt;/P&gt;</description>
      <pubDate>Fri, 23 Dec 2022 07:50:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Unexplainable-SQL-Result/m-p/585036#M79076</guid>
      <dc:creator>peterrow</dc:creator>
      <dc:date>2022-12-23T07:50:25Z</dc:date>
    </item>
  </channel>
</rss>

