<?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: Emulating FULL OUTER JOIN in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Emulating-FULL-OUTER-JOIN/m-p/202842#M58878</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;index=MYINDEX source=MYSOURCE 
                  | eval Day = strftime(_time,"%F")
                  | eval DateTime = strftime(_time,"%Y-%m-%d %H:%M:%S")
                  | stats Latest(LogType) as status Latest(Result) as Result Latest(DateTime) as When by PackageName  ,ExecutionInstanceGUID, Day
                  | sort When
                  | streamstats  count as "Execution Nr" by PackageName, Day
                  | sort - When
                  | table When, PackageName, "Execution Nr",  status, Result, ExecutionInstanceGUID
                  | eval AlertLevel = case(Result=="OK",1,Result=="WARNING",2,Result=="KO",3)
                  | rangemap field=AlertLevel low=1-1 elevated=2-2 severe=3-3 default=guarded
                  | fields - AlertLevel
                  | join type=outer ExecutionInstanceGUID[
                         search index=MYINDEX source=MYSOURCE
                         | rename ExplodedPackages{}.Error AS Error, ExplodedPackages{}.Package AS Package, ExplodedPackages{}.TimeStamp AS TimeStamp
                         | eval x=mvzip(TimeStamp,mvzip(Package,Error))
                         | mvexpand x
                         | eval y=mvzip(ExecutionInstanceGUID,x)
                         | mvexpand y
                         | eval z=split(y,",") 
                         | eval ExecutionInstanceGUID=mvindex(z,0)
                         | eval TimeStamp=mvindex(z,1)
                         | eval Package=mvindex(z,2)
                         | eval Error=mvindex(z,3)
                         | table ExecutionInstanceGUID,TimeStamp, Package, Error
                  ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;With this syntax I get just one error for each row in the first table&lt;/P&gt;</description>
    <pubDate>Wed, 02 Nov 2016 14:37:17 GMT</pubDate>
    <dc:creator>andreafebbo</dc:creator>
    <dc:date>2016-11-02T14:37:17Z</dc:date>
    <item>
      <title>Emulating FULL OUTER JOIN</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Emulating-FULL-OUTER-JOIN/m-p/202840#M58876</link>
      <description>&lt;P&gt;Hi, &lt;BR /&gt;
I have to tables:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;ID name&lt;BR /&gt;
1..A&lt;BR /&gt;
2..B&lt;/P&gt;

&lt;P&gt;ID Error&lt;BR /&gt;
1..bla1&lt;BR /&gt;
1..bla2&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;so Id like a table which is like the following&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;ID name error&lt;BR /&gt;
1..A........bla1&lt;BR /&gt;
1..A........bla2&lt;BR /&gt;
2..B........(empty)&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;In SQL this is called FULL OUTER JOIN but i cannot find a way to replicate it since the parameter &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;type=outer
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;in the command join means LEFT JOIN in the reality.&lt;/P&gt;

&lt;P&gt;I found some questions that try to resolve the issue with the search command but in my case it does not work.&lt;/P&gt;

&lt;P&gt;Thank you &lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 14:07:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Emulating-FULL-OUTER-JOIN/m-p/202840#M58876</guid>
      <dc:creator>andreafebbo</dc:creator>
      <dc:date>2016-11-02T14:07:28Z</dc:date>
    </item>
    <item>
      <title>Re: Emulating FULL OUTER JOIN</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Emulating-FULL-OUTER-JOIN/m-p/202841#M58877</link>
      <description>&lt;P&gt;can you provide syntax with how you get current tables? You might be able to use appendpipe.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 14:30:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Emulating-FULL-OUTER-JOIN/m-p/202841#M58877</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2016-11-02T14:30:27Z</dc:date>
    </item>
    <item>
      <title>Re: Emulating FULL OUTER JOIN</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Emulating-FULL-OUTER-JOIN/m-p/202842#M58878</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index=MYINDEX source=MYSOURCE 
                  | eval Day = strftime(_time,"%F")
                  | eval DateTime = strftime(_time,"%Y-%m-%d %H:%M:%S")
                  | stats Latest(LogType) as status Latest(Result) as Result Latest(DateTime) as When by PackageName  ,ExecutionInstanceGUID, Day
                  | sort When
                  | streamstats  count as "Execution Nr" by PackageName, Day
                  | sort - When
                  | table When, PackageName, "Execution Nr",  status, Result, ExecutionInstanceGUID
                  | eval AlertLevel = case(Result=="OK",1,Result=="WARNING",2,Result=="KO",3)
                  | rangemap field=AlertLevel low=1-1 elevated=2-2 severe=3-3 default=guarded
                  | fields - AlertLevel
                  | join type=outer ExecutionInstanceGUID[
                         search index=MYINDEX source=MYSOURCE
                         | rename ExplodedPackages{}.Error AS Error, ExplodedPackages{}.Package AS Package, ExplodedPackages{}.TimeStamp AS TimeStamp
                         | eval x=mvzip(TimeStamp,mvzip(Package,Error))
                         | mvexpand x
                         | eval y=mvzip(ExecutionInstanceGUID,x)
                         | mvexpand y
                         | eval z=split(y,",") 
                         | eval ExecutionInstanceGUID=mvindex(z,0)
                         | eval TimeStamp=mvindex(z,1)
                         | eval Package=mvindex(z,2)
                         | eval Error=mvindex(z,3)
                         | table ExecutionInstanceGUID,TimeStamp, Package, Error
                  ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;With this syntax I get just one error for each row in the first table&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 14:37:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Emulating-FULL-OUTER-JOIN/m-p/202842#M58878</guid>
      <dc:creator>andreafebbo</dc:creator>
      <dc:date>2016-11-02T14:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: Emulating FULL OUTER JOIN</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Emulating-FULL-OUTER-JOIN/m-p/202843#M58879</link>
      <description>&lt;P&gt;try something like this, maybe:&lt;/P&gt;

&lt;P&gt;UPDATED&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=MYINDEX source=MYSOURCE 
                   | eval Day = strftime(_time,"%F")
                   | eval DateTime = strftime(_time,"%Y-%m-%d %H:%M:%S")
                   | stats Latest(LogType) as status Latest(Result) as Result Latest(DateTime) as When by PackageName  ,ExecutionInstanceGUID, Day
                   | sort When
                   | streamstats  count as "Execution Nr" by PackageName, Day
                   | sort - When
                   | table When, PackageName, "Execution Nr",  status, Result, ExecutionInstanceGUID
                   | eval AlertLevel = case(Result=="OK",1,Result=="WARNING",2,Result=="KO",3)
                   | rangemap field=AlertLevel low=1-1 elevated=2-2 severe=3-3 default=guarded
                   | fields - AlertLevel
|appendpipe [stats count by ExecutionInstanceGUID | join type=outer ExecutionInstanceGUID [
                   search index=MYINDEX source=MYSOURCE
                   | rename ExplodedPackages{}.Error AS Error, ExplodedPackages{}.Package AS Package, ExplodedPackages{}.TimeStamp AS TimeStamp
                   | eval x=mvzip(TimeStamp,mvzip(Package,Error))
                   | mvexpand x
                   | eval y=mvzip(ExecutionInstanceGUID,x)
                   | mvexpand y
                   | eval z=split(y,",") 
                   | eval ExecutionInstanceGUID=mvindex(z,0)
                   | eval TimeStamp=mvindex(z,1)
                   | eval Package=mvindex(z,2)
                   | eval Error=mvindex(z,3)
                   | table ExecutionInstanceGUID,TimeStamp, Package, Error]]
|stats values(PackageName) as PackageName by ExecutionInstanceGUID Error
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Nov 2016 15:15:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Emulating-FULL-OUTER-JOIN/m-p/202843#M58879</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2016-11-02T15:15:23Z</dc:date>
    </item>
    <item>
      <title>Re: Emulating FULL OUTER JOIN</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Emulating-FULL-OUTER-JOIN/m-p/202844#M58880</link>
      <description>&lt;P&gt;THe result of this query is the following:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;1..A&lt;BR /&gt;
2..B&lt;BR /&gt;
1.......bla1&lt;BR /&gt;
1.......bla2&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;and not:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;1..A..bla1&lt;BR /&gt;
1..A..bla2&lt;BR /&gt;
2..B........&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Thu, 03 Nov 2016 09:55:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Emulating-FULL-OUTER-JOIN/m-p/202844#M58880</guid>
      <dc:creator>andreafebbo</dc:creator>
      <dc:date>2016-11-03T09:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: Emulating FULL OUTER JOIN</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Emulating-FULL-OUTER-JOIN/m-p/202845#M58881</link>
      <description>&lt;P&gt;I understand your requirement is more involved, but given the basic datasets from above the following search produces similar results to that shown:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=MYINDEX source=MYSOURCE | stats values(error) as error values(name) as name  by id | eval error=if(isnull(error),"NULL",error)  | mvexpand error | table id name error
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Dave&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 12:19:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Emulating-FULL-OUTER-JOIN/m-p/202845#M58881</guid>
      <dc:creator>davebrooking</dc:creator>
      <dc:date>2016-11-03T12:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: Emulating FULL OUTER JOIN</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Emulating-FULL-OUTER-JOIN/m-p/202846#M58882</link>
      <description>&lt;P&gt;try my updated syntax. I used a stats command at the bottom to bring back the values of the PackageName by the ID and Error, so it should join the 1s and bla1/bla2s.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 12:27:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Emulating-FULL-OUTER-JOIN/m-p/202846#M58882</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2016-11-03T12:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: Emulating FULL OUTER JOIN</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Emulating-FULL-OUTER-JOIN/m-p/202847#M58883</link>
      <description>&lt;P&gt;Nothing: now it shows just 3 columns:&lt;BR /&gt;
ExecutionInstanceGUID &lt;BR /&gt;
Error &lt;BR /&gt;
PackageName (empty column).&lt;/P&gt;

&lt;P&gt;In the example, what i call the column name(A, B) is one column but in the reality are many columns(as you can see in the query). I need all of them&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2016 10:21:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Emulating-FULL-OUTER-JOIN/m-p/202847#M58883</guid>
      <dc:creator>andreafebbo</dc:creator>
      <dc:date>2016-11-04T10:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: Emulating FULL OUTER JOIN</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Emulating-FULL-OUTER-JOIN/m-p/202848#M58884</link>
      <description>&lt;P&gt;you might need to play with the stats command at the bottom, join by any of the column names that might be in common, or do a latest instead of values.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|stats values(*) as * by ExecutionInstanceGUID 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Nov 2016 12:10:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Emulating-FULL-OUTER-JOIN/m-p/202848#M58884</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2016-11-04T12:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: Emulating FULL OUTER JOIN</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Emulating-FULL-OUTER-JOIN/m-p/202849#M58885</link>
      <description>&lt;P&gt;This seems like you just want to do a Left join. so &lt;/P&gt;

&lt;P&gt;index=A|table ID Name | join type=left max=0 ID [search index=B |table ID Error]&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2017 19:35:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Emulating-FULL-OUTER-JOIN/m-p/202849#M58885</guid>
      <dc:creator>tdiestel</dc:creator>
      <dc:date>2017-07-26T19:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: Emulating FULL OUTER JOIN</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Emulating-FULL-OUTER-JOIN/m-p/202850#M58886</link>
      <description>&lt;P&gt;Thanks, man, that's indeed the great answer, which helped me a lot. But what is the max=0 indicates here? Event If there is not any data in the index B, still it shows 1, without max=0 it calculates all of them as 1. &lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2020 09:11:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Emulating-FULL-OUTER-JOIN/m-p/202850#M58886</guid>
      <dc:creator>arlington</dc:creator>
      <dc:date>2020-02-05T09:11:28Z</dc:date>
    </item>
    <item>
      <title>Re: Emulating FULL OUTER JOIN</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Emulating-FULL-OUTER-JOIN/m-p/587628#M204641</link>
      <description>&lt;P&gt;The author needed a left join as mentioned before, but I see demand for this task is still high.&lt;/P&gt;&lt;P&gt;I spent a little bit of time on this. So, try the following.&lt;/P&gt;&lt;PRE&gt;| inputlookup tableA | eval key=localfield1&lt;BR /&gt;| append [|inputlookup tableB | eval key=localfield2]&lt;BR /&gt;| selfjoin max=0 keepsingle=yes key&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2022 10:02:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Emulating-FULL-OUTER-JOIN/m-p/587628#M204641</guid>
      <dc:creator>sandrosov_splun</dc:creator>
      <dc:date>2022-03-04T10:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: Emulating FULL OUTER JOIN</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Emulating-FULL-OUTER-JOIN/m-p/695084#M236382</link>
      <description>&lt;P&gt;absolutely great, because it is also expandable to more than two datasets to be compared. here's what i done for a "triff":&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=a | stats count by PSP_Element | rename * as a_* | rename a_PSP_Element as PSP_Element | eval a=1
| append [ | inputlookup koop_aws_spitz_zahlen PSP_Element=* | rename * as b_* | rename b_PSP_Element as PSP_Element | eval b=1 ]
| selfjoin max=0 keepsingle=yes PSP_Element&lt;/LI-CODE&gt;
&lt;P&gt;| append [ | makeresults format=csv data="PSP_Element&lt;BR /&gt;F-330751&lt;BR /&gt;F-330755&lt;BR /&gt;F-330758&lt;BR /&gt;"&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| rename * as c_* | rename c_PSP_Element as PSP_Element | eval c=1 ]
| selfjoin max=0 keepsingle=yes PSP_Element

| where isnull(a) OR isnull(b) OR isnull(c)

| eval x = coalesce(b_PLAN,a_Preis) | sort - x | fields - x

| fields PSP_Element c a b *&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 02 Aug 2024 12:04:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Emulating-FULL-OUTER-JOIN/m-p/695084#M236382</guid>
      <dc:creator>carbdb</dc:creator>
      <dc:date>2024-08-02T12:04:23Z</dc:date>
    </item>
  </channel>
</rss>

