<?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 merge two different queries with the same columns together? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-different-queries-with-the-same-columns/m-p/501715#M195144</link>
    <description>&lt;P&gt;I know what the problem is - typo &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;BR /&gt;
But your response was correct - thank you&lt;/P&gt;</description>
    <pubDate>Thu, 05 Dec 2019 12:04:54 GMT</pubDate>
    <dc:creator>shayhibah</dc:creator>
    <dc:date>2019-12-05T12:04:54Z</dc:date>
    <item>
      <title>How to merge two different queries with the same columns together?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-different-queries-with-the-same-columns/m-p/501710#M195139</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have  different queries:&lt;/P&gt;

&lt;P&gt;Query 1: &lt;BR /&gt;
|inputlookup myLokkup |  eval count=0 | table myField, count&lt;BR /&gt;
For Example:&lt;BR /&gt;
myField          count&lt;BR /&gt;
A                      0&lt;BR /&gt;
B                      0&lt;BR /&gt;
C                      0&lt;/P&gt;

&lt;P&gt;Query 2:&lt;BR /&gt;
sourcetype="my_log" | stats count by myField&lt;BR /&gt;
For Example:&lt;BR /&gt;
myField          count&lt;BR /&gt;
A                      4&lt;BR /&gt;
C                      2&lt;/P&gt;

&lt;P&gt;How can I combine these 2 queries to return  the following:&lt;BR /&gt;
myField          count&lt;BR /&gt;
A                      4&lt;BR /&gt;
B                      0&lt;BR /&gt;
C                      2&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 10:48:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-different-queries-with-the-same-columns/m-p/501710#M195139</guid>
      <dc:creator>shayhibah</dc:creator>
      <dc:date>2019-12-05T10:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge two different queries with the same columns together?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-different-queries-with-the-same-columns/m-p/501711#M195140</link>
      <description>&lt;P&gt;@shayhibah &lt;/P&gt;

&lt;P&gt;Can you please try this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="my_log" 
| stats count by myField
| append [ |inputlookup myLokkup | eval count=0 | table myField, count ] 
| stats sum(count) as count by myField
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 10:55:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-different-queries-with-the-same-columns/m-p/501711#M195140</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-12-05T10:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge two different queries with the same columns together?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-different-queries-with-the-same-columns/m-p/501712#M195141</link>
      <description>&lt;P&gt;hi @kamlesh_vaghela &lt;/P&gt;

&lt;P&gt;The output is incorrect:&lt;/P&gt;

&lt;P&gt;A0&lt;BR /&gt;
A 4&lt;BR /&gt;
B 0&lt;BR /&gt;
C0&lt;BR /&gt;
C 2&lt;/P&gt;

&lt;P&gt;It didn't remove fields that exist in both searches&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 11:43:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-different-queries-with-the-same-columns/m-p/501712#M195141</guid>
      <dc:creator>shayhibah</dc:creator>
      <dc:date>2019-12-05T11:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge two different queries with the same columns together?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-different-queries-with-the-same-columns/m-p/501713#M195142</link>
      <description>&lt;P&gt;@shayhibah&lt;/P&gt;

&lt;P&gt;I think  it should work.  Can you please confirm that count doesn't have any extra hidden character. &lt;/P&gt;

&lt;P&gt;Please check below sample search with same logic.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval myField="A,C",myField=split(myField,","),count=20 | mvexpand myField | table myField count | append [| makeresults | eval myField="A,B,C",myField=split(myField,","),count=0 | mvexpand myField | table myField count] | stats sum(count) as count by myField
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is it possible to share your search with sample values?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 11:53:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-different-queries-with-the-same-columns/m-p/501713#M195142</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-12-05T11:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge two different queries with the same columns together?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-different-queries-with-the-same-columns/m-p/501714#M195143</link>
      <description>&lt;P&gt;@kamlesh_vaghela &lt;BR /&gt;
Sure,&lt;/P&gt;

&lt;P&gt;This is my query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="my_log" | stats count by my_field
| append [|inputlookup my_lookup | rename field AS my_field | eval count=0 | table my_field, count]
| stats sum(count) as count by my_field
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For some reason your query above works fine but mine does not.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 12:01:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-different-queries-with-the-same-columns/m-p/501714#M195143</guid>
      <dc:creator>shayhibah</dc:creator>
      <dc:date>2019-12-05T12:01:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge two different queries with the same columns together?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-different-queries-with-the-same-columns/m-p/501715#M195144</link>
      <description>&lt;P&gt;I know what the problem is - typo &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;BR /&gt;
But your response was correct - thank you&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 12:04:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-different-queries-with-the-same-columns/m-p/501715#M195144</guid>
      <dc:creator>shayhibah</dc:creator>
      <dc:date>2019-12-05T12:04:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge two different queries with the same columns together?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-different-queries-with-the-same-columns/m-p/501716#M195145</link>
      <description>&lt;P&gt;@shayhibah&lt;/P&gt;

&lt;P&gt;I think your lookup &lt;CODE&gt;field&lt;/CODE&gt; has extra spaces.&lt;BR /&gt;
Try this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="my_log" | stats count by my_field
 | append [|inputlookup my_lookup | rename field AS my_field | eval count=0 | eval myField=trim(myField) | table my_field, count]
 | stats sum(count) as count by my_field
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Dec 2019 12:05:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-different-queries-with-the-same-columns/m-p/501716#M195145</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-12-05T12:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge two different queries with the same columns together?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-different-queries-with-the-same-columns/m-p/501717#M195146</link>
      <description>&lt;P&gt;ooh Great.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Happy Splunking&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 12:06:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-different-queries-with-the-same-columns/m-p/501717#M195146</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-12-05T12:06:37Z</dc:date>
    </item>
  </channel>
</rss>

