<?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: Left Join Not Returning All Fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Left-Join-Not-Returning-All-Fields/m-p/347300#M102833</link>
    <description>&lt;P&gt;stats as a last resort?&lt;/P&gt;</description>
    <pubDate>Sun, 24 Sep 2017 16:01:55 GMT</pubDate>
    <dc:creator>jkat54</dc:creator>
    <dc:date>2017-09-24T16:01:55Z</dc:date>
    <item>
      <title>Left Join Not Returning All Fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Left-Join-Not-Returning-All-Fields/m-p/347298#M102831</link>
      <description>&lt;P&gt;So as an example:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Primary Table&lt;/STRONG&gt; &lt;BR /&gt;
Customer 1, 2, 3&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Secondary Table&lt;/STRONG&gt;&lt;BR /&gt;
Customer 1,2,3,2&lt;BR /&gt;
Spend 100, 200, 300, 400&lt;/P&gt;

&lt;P&gt;Search: index=primary | join Customer [search index=secondary] | table Customer Spend&lt;/P&gt;

&lt;P&gt;Output is&lt;BR /&gt;
Customer 1, 2, 3&lt;BR /&gt;
Spend 100, 400, 300&lt;/P&gt;

&lt;P&gt;It is NOT returning all values from Customer 2.  Need ALL values from secondary table, not just one.  Please advise.  Thanks!&lt;/P&gt;</description>
      <pubDate>Sun, 24 Sep 2017 13:38:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Left-Join-Not-Returning-All-Fields/m-p/347298#M102831</guid>
      <dc:creator>ryanprayacn</dc:creator>
      <dc:date>2017-09-24T13:38:45Z</dc:date>
    </item>
    <item>
      <title>Re: Left Join Not Returning All Fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Left-Join-Not-Returning-All-Fields/m-p/347299#M102832</link>
      <description>&lt;P&gt;hi - Firstly if you do not specifically specify the join type its takes default as inner - from splunk join documentation 'Syntax: type=inner | outer | left&lt;BR /&gt;
Description: Indicates the type of join to perform. The difference between an inner and a left (or outer) join is how the events are treated in the main search that do not match any of the events in the subsearch. In both inner and left joins, events that match are joined. The results of an inner join do not include events from the main search that have no matches in the subsearch. The results of a left (or outer) join includes all of the events in the main search and only those values in the subsearch have matching field values.&lt;BR /&gt;
Default: inner'&lt;BR /&gt;
Second- max&lt;BR /&gt;
Syntax: max=&lt;BR /&gt;
Description: Specifies the maximum number of subsearch results that each main search result can join with. If set to max=0, there is no limit.&lt;BR /&gt;
Default: 1&lt;BR /&gt;
so probably what you need is - index=primary | join type=left Customer max=0 [search index=secondary] | table Customer Spend&lt;/P&gt;

&lt;P&gt;You however need the inner / outer join in case you want common fields. The reason your query is working is because you have same values for customer in both searches. Without specifying a 'left' join type say if there was a customer value 4, you would not have got any returns from the sub search even if there was a customer with value 4 in the sub search.&lt;BR /&gt;
BTW - Consider using stats, count, or appendcols and join as a last resort&lt;/P&gt;</description>
      <pubDate>Sun, 24 Sep 2017 14:51:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Left-Join-Not-Returning-All-Fields/m-p/347299#M102832</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2017-09-24T14:51:01Z</dc:date>
    </item>
    <item>
      <title>Re: Left Join Not Returning All Fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Left-Join-Not-Returning-All-Fields/m-p/347300#M102833</link>
      <description>&lt;P&gt;stats as a last resort?&lt;/P&gt;</description>
      <pubDate>Sun, 24 Sep 2017 16:01:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Left-Join-Not-Returning-All-Fields/m-p/347300#M102833</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-09-24T16:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: Left Join Not Returning All Fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Left-Join-Not-Returning-All-Fields/m-p/347301#M102834</link>
      <description>&lt;P&gt;Consider using stats, count, or appendcols and THEN join ONLY as a last resort &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Sep 2017 16:18:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Left-Join-Not-Returning-All-Fields/m-p/347301#M102834</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2017-09-24T16:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: Left Join Not Returning All Fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Left-Join-Not-Returning-All-Fields/m-p/347302#M102835</link>
      <description>&lt;P&gt;The power of words!&lt;/P&gt;</description>
      <pubDate>Sun, 24 Sep 2017 16:44:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Left-Join-Not-Returning-All-Fields/m-p/347302#M102835</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-09-24T16:44:04Z</dc:date>
    </item>
    <item>
      <title>Re: Left Join Not Returning All Fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Left-Join-Not-Returning-All-Fields/m-p/347303#M102836</link>
      <description>&lt;P&gt;Thank you!  I had accidentally left out the "type=left" in my example.  Not including "max" was my issue.&lt;/P&gt;

&lt;P&gt;I agree that "join" is a last resort.  How would you do this sample search with something more effective (since join is max 50,000).  Thanks!&lt;/P&gt;</description>
      <pubDate>Sun, 24 Sep 2017 16:49:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Left-Join-Not-Returning-All-Fields/m-p/347303#M102836</guid>
      <dc:creator>ryanprayacn</dc:creator>
      <dc:date>2017-09-24T16:49:14Z</dc:date>
    </item>
  </channel>
</rss>

