<?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: How to use self join in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-self-join/m-p/500439#M195086</link>
    <description>&lt;P&gt;Thanks for your efforts really appreciate your time but however it did not met my requirement&lt;/P&gt;</description>
    <pubDate>Fri, 11 Oct 2019 06:28:34 GMT</pubDate>
    <dc:creator>shugup2923</dc:creator>
    <dc:date>2019-10-11T06:28:34Z</dc:date>
    <item>
      <title>How to use self join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-self-join/m-p/500433#M195080</link>
      <description>&lt;P&gt;Hi All,&lt;BR /&gt;
I have table in which I have columns such as name, id, type, business group etc&lt;BR /&gt;
type field has 2 values 'user' or 'approver', there are some name which are both are user as well as approver for same id. &lt;/P&gt;

&lt;P&gt;My requirement is to create a two new columns 'isapprover' and 'isuser' which will contain value yes or no.&lt;/P&gt;

&lt;P&gt;I was able to create these two columns by using &lt;BR /&gt;
if type is user put yes in isuser and&lt;BR /&gt;
 if type is approver put yes in isapprover.&lt;/P&gt;

&lt;P&gt;Issue: If any name type is both user and approver I need yes and yes value in 'isapprover' and 'isuser' in every row where that name is present for same id.&lt;/P&gt;

&lt;P&gt;Any help will be appreciated.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 12:52:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-self-join/m-p/500433#M195080</guid>
      <dc:creator>shugup2923</dc:creator>
      <dc:date>2019-10-10T12:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to use self join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-self-join/m-p/500434#M195081</link>
      <description>&lt;P&gt;If a name is both a user and approver, is that two separate rows or two values within the type field or two type fields?&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 13:11:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-self-join/m-p/500434#M195081</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-10-10T13:11:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to use self join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-self-join/m-p/500435#M195082</link>
      <description>&lt;P&gt;It will be two different rows , for ex-&lt;BR /&gt;
name id group type&lt;BR /&gt;
xyz 123 abc user&lt;BR /&gt;
xyz 123 def approver&lt;BR /&gt;
xyz 123 ghi user &lt;/P&gt;

&lt;P&gt;expected result&lt;BR /&gt;
name id group type isuser isapprover&lt;BR /&gt;
xyz 123 abc user yes yes&lt;BR /&gt;
xyz 123 def approver yes yes&lt;BR /&gt;
xyz 123 ghi user yes yes&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 13:16:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-self-join/m-p/500435#M195082</guid>
      <dc:creator>shugup2923</dc:creator>
      <dc:date>2019-10-10T13:16:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to use self join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-self-join/m-p/500436#M195083</link>
      <description>&lt;P&gt;If I understand you correctly, you're going to replace/reformat the current lookup to &lt;EM&gt;remove&lt;/EM&gt; the &lt;CODE&gt;type&lt;/CODE&gt; field, and instead replace it with a combination of &lt;CODE&gt;isuser&lt;/CODE&gt; and &lt;CODE&gt;isapprover&lt;/CODE&gt; fields. Is that correct?&lt;/P&gt;

&lt;P&gt;(FWIW - since every one of these entries &lt;EM&gt;must be&lt;/EM&gt; a user, the &lt;CODE&gt;isuser&lt;/CODE&gt; field is going to be redundant)&lt;/P&gt;

&lt;P&gt;Should be able to do something like the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup mylookup.csv
| stats values(type) as type by name id business_group [...]
| eval isuser="Yes"
| eval isapprover=if(mvfind(type,"approver")&amp;gt;=0,"Yes","No")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Append a &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| outputlookup mylookup.csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;line to end of the search when you verify it's exactly how you want to see it&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 14:02:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-self-join/m-p/500436#M195083</guid>
      <dc:creator>wmyersas</dc:creator>
      <dc:date>2019-10-10T14:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to use self join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-self-join/m-p/500437#M195084</link>
      <description>&lt;P&gt;Try this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo (type="user" OR type="approver") | fields name, id, type. group
| eval isapprover=if(type="approver", "yes", "no"), isuser=if(type="user", "yes", "no")
| stats values(*) as * by name
| table name id group type isuser isapprover
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Oct 2019 15:29:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-self-join/m-p/500437#M195084</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-10-10T15:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to use self join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-self-join/m-p/500438#M195085</link>
      <description>&lt;P&gt;Thanks it worked , just one change what  I did is I have used eventstats as there were other fields also &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2019 06:27:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-self-join/m-p/500438#M195085</guid>
      <dc:creator>shugup2923</dc:creator>
      <dc:date>2019-10-11T06:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to use self join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-self-join/m-p/500439#M195086</link>
      <description>&lt;P&gt;Thanks for your efforts really appreciate your time but however it did not met my requirement&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2019 06:28:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-self-join/m-p/500439#M195086</guid>
      <dc:creator>shugup2923</dc:creator>
      <dc:date>2019-10-11T06:28:34Z</dc:date>
    </item>
  </channel>
</rss>

