<?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: Combine two tables without the use of join and without aggregating values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Combine-two-tables-without-the-use-of-join-and-without/m-p/563478#M196310</link>
    <description>&lt;P&gt;Alternatively, if your second "table" was not a lookup but a search, you could use eventstats to "join" the "tables"&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| gentimes start=-1 increment=10m 
| rename starttime as _time 
| fields - endhuman endtime starthuman 
| eval count=random() % 20 
| eval office=mvindex(split("xxx,yyy,zzz",","),random() % 3)
| eval importance=mvindex(split("very important,important,less important",","),random() % 3)
| eval source="task"
| append
    [| makeresults 
    | eval range=mvrange(1,4)
    | mvexpand range
    | eval office=mvindex(split("xxx,yyy,zzz",","),range % 3)
    | eval country=mvindex(split("Spain,France,Italy",","),range % 3)
    | eval city=mvindex(split("Madrid,Paris,Rome",","),range % 3)
    | fields - range]
| eventstats values(country) as country values(city) as city by office
| where isnotnull(count)&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 16 Aug 2021 13:00:15 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2021-08-16T13:00:15Z</dc:date>
    <item>
      <title>Combine two tables without the use of join and without aggregating values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-two-tables-without-the-use-of-join-and-without/m-p/563463#M196298</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm working on a really complex search where I need to combine results from different lookup tables. One lookup table is really big with multiple million entries, while the other one is quite small with only a thousand entries.&amp;nbsp;&lt;BR /&gt;Both tables have one common field, let's call it "office". The big tables has entries for task which are applied to a certain office. The other table has more information about the office.&amp;nbsp;&lt;BR /&gt;Some example data for the task lookup:&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="25%" height="24px"&gt;office&lt;/TD&gt;&lt;TD width="25%" height="24px"&gt;city&lt;/TD&gt;&lt;TD width="25%" height="24px"&gt;country&lt;/TD&gt;&lt;TD width="25%" height="24px"&gt;importance&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="24px"&gt;xxx&lt;/TD&gt;&lt;TD width="25%" height="24px"&gt;madrid&lt;/TD&gt;&lt;TD width="25%" height="24px"&gt;spain&lt;/TD&gt;&lt;TD width="25%" height="24px"&gt;very important&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="24px"&gt;yyy&lt;/TD&gt;&lt;TD width="25%" height="24px"&gt;paris&lt;/TD&gt;&lt;TD width="25%" height="24px"&gt;france&lt;/TD&gt;&lt;TD width="25%" height="24px"&gt;important&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Office table looks similar to this:&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="24px"&gt;office&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="24px"&gt;group&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="24px"&gt;name&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="24px"&gt;xxx&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="24px"&gt;this&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="24px"&gt;aaa&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="24px"&gt;yyy&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="24px"&gt;that&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="24px"&gt;bbb&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to add the group and name fields to the first task table, without loosing any entries from the task table, so I can continue working with it. I've tried a lot of different approaches but none of them work. I got the best results with this search, but it's still not the outcome I want:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup task_lookup 
| eval importance_very_important=if(match(importance, "very important"), 1, 0), importance_important=if(match(importance, "important"), 1, 0), importance_less_important=if(match(importance, "less important"), 1, 0)
| eval source="task"
| append [| inputlookup office_lookup | eval source="office"]
| stats values(source) as source, values(country) as country, values(city) as city, sum(importance_*) as *, values(group) as group, values(name) as name by office
| where mvcount(source)=2&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This search gives me the right combination of fields BUT it also combines the different cities and countries, which I don't want, since I need them seperated so I can filter them. I get the following outcome (e.g.):&lt;/P&gt;&lt;TABLE border="1" width="79.01170970154725%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="11.11111111111111%" height="24px"&gt;office&lt;/TD&gt;&lt;TD width="11.11111111111111%" height="24px"&gt;country&lt;/TD&gt;&lt;TD width="11.11111111111111%" height="24px"&gt;city&lt;/TD&gt;&lt;TD width="11.11111111111111%" height="24px"&gt;name&lt;/TD&gt;&lt;TD width="11.11111111111111%" height="24px"&gt;group&lt;/TD&gt;&lt;TD width="11.11111111111111%" height="24px"&gt;very_important&lt;/TD&gt;&lt;TD width="11.11111111111111%" height="24px"&gt;important&lt;/TD&gt;&lt;TD width="11.11111111111111%" height="24px"&gt;less_important&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="11.11111111111111%" height="112px"&gt;xxx&lt;/TD&gt;&lt;TD width="11.11111111111111%" height="112px"&gt;&lt;P&gt;madrid&lt;/P&gt;&lt;P&gt;paris&lt;/P&gt;&lt;/TD&gt;&lt;TD width="11.11111111111111%" height="112px"&gt;&lt;P&gt;spain&lt;/P&gt;&lt;P&gt;france&lt;/P&gt;&lt;P&gt;italy&lt;/P&gt;&lt;/TD&gt;&lt;TD width="11.11111111111111%" height="112px"&gt;aaa&lt;/TD&gt;&lt;TD width="11.11111111111111%" height="112px"&gt;this&lt;/TD&gt;&lt;TD width="11.11111111111111%" height="112px"&gt;3&lt;/TD&gt;&lt;TD width="11.11111111111111%" height="112px"&gt;7&lt;/TD&gt;&lt;TD width="11.11111111111111%" height="112px"&gt;8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="11.11111111111111%" height="24px"&gt;yyy&lt;/TD&gt;&lt;TD width="11.11111111111111%" height="24px"&gt;&lt;P&gt;rome&lt;/P&gt;&lt;P&gt;paris&lt;/P&gt;&lt;/TD&gt;&lt;TD width="11.11111111111111%" height="24px"&gt;&lt;P&gt;france&lt;/P&gt;&lt;P&gt;spain&lt;/P&gt;&lt;/TD&gt;&lt;TD width="11.11111111111111%" height="24px"&gt;bbb&lt;/TD&gt;&lt;TD width="11.11111111111111%" height="24px"&gt;that&lt;/TD&gt;&lt;TD width="11.11111111111111%" height="24px"&gt;5&lt;/TD&gt;&lt;TD width="11.11111111111111%" height="24px"&gt;3&lt;/TD&gt;&lt;TD width="11.11111111111111%" height="24px"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So all in all I need a result table that doesn't combine any values so I can work with them seperately. I'm at a point where I have no clue how to accomplish this, so any help would be highly appreciated! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;BR /&gt;Additional info: I don't want to use join since the first lookup has so many entries, I don't thinks that's going to work. I also can't just use mvexpand, since it doesn't properly expand the counts for the different task counts with their importance.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Aug 2021 12:08:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-two-tables-without-the-use-of-join-and-without/m-p/563463#M196298</guid>
      <dc:creator>moonie</dc:creator>
      <dc:date>2021-08-16T12:08:23Z</dc:date>
    </item>
    <item>
      <title>Re: Combine two tables without the use of join and without aggregating values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-two-tables-without-the-use-of-join-and-without/m-p/563472#M196307</link>
      <description>&lt;P&gt;While the &lt;FONT face="courier new,courier"&gt;inputlookup&lt;/FONT&gt; command can be powerful, many seem to forget the usefulness and simplicity of &lt;FONT face="courier new,courier"&gt;lookup&lt;/FONT&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup task_lookup 
| eval importance_very_important=if(match(importance, "very important"), 1, 0), importance_important=if(match(importance, "important"), 1, 0), importance_less_important=if(match(importance, "less important"), 1, 0)
| eval source="task"
| lookup office_lookup office&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Aug 2021 12:59:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-two-tables-without-the-use-of-join-and-without/m-p/563472#M196307</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-08-16T12:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: Combine two tables without the use of join and without aggregating values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-two-tables-without-the-use-of-join-and-without/m-p/563476#M196309</link>
      <description>&lt;P&gt;This works perfectly, thank you so much!!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I didn't even think of lookup, but I'll def keep it in mind now for further searches. What a great solution. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Aug 2021 12:56:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-two-tables-without-the-use-of-join-and-without/m-p/563476#M196309</guid>
      <dc:creator>moonie</dc:creator>
      <dc:date>2021-08-16T12:56:57Z</dc:date>
    </item>
    <item>
      <title>Re: Combine two tables without the use of join and without aggregating values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-two-tables-without-the-use-of-join-and-without/m-p/563478#M196310</link>
      <description>&lt;P&gt;Alternatively, if your second "table" was not a lookup but a search, you could use eventstats to "join" the "tables"&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| gentimes start=-1 increment=10m 
| rename starttime as _time 
| fields - endhuman endtime starthuman 
| eval count=random() % 20 
| eval office=mvindex(split("xxx,yyy,zzz",","),random() % 3)
| eval importance=mvindex(split("very important,important,less important",","),random() % 3)
| eval source="task"
| append
    [| makeresults 
    | eval range=mvrange(1,4)
    | mvexpand range
    | eval office=mvindex(split("xxx,yyy,zzz",","),range % 3)
    | eval country=mvindex(split("Spain,France,Italy",","),range % 3)
    | eval city=mvindex(split("Madrid,Paris,Rome",","),range % 3)
    | fields - range]
| eventstats values(country) as country values(city) as city by office
| where isnotnull(count)&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 16 Aug 2021 13:00:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-two-tables-without-the-use-of-join-and-without/m-p/563478#M196310</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-08-16T13:00:15Z</dc:date>
    </item>
  </channel>
</rss>

