<?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 How to search using values from another search result? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-using-values-from-another-search-result/m-p/619014#M215138</link>
    <description>&lt;P&gt;Please help...&lt;BR /&gt;&lt;BR /&gt;1st search query is where I get a value from the result. (value can be in either 1 of 3 fields)&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;index=index1 | table SQ1-user SQ1-field1 SQ1-field2 SQ1-field3&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="25%" height="25px"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;SQ1-user&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;SQ1-field1&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;SQ1-field2&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;SQ1-field3&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%" height="25px"&gt;john&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;null&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;null&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;apple&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%" height="25px"&gt;jane&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;null&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;orange&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;null&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%" height="25px"&gt;doe&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;banana&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;null&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;null&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&lt;BR /&gt;From that value, I want to use it to check if it exist in another search query, (the value can be on any fields)&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;index=index2 | where ANY_FIELD=SQ1-field1 OR ANY_FIELD=SQ1-field2 OR ANY_FIELD=SQ1-field3&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="25%" height="25px"&gt;&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;SQ2-ID&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;SQ2-field1&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;SQ2-field2&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;SQ2-field3&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%" height="25px"&gt;001&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;null&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;apple&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;null&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%" height="25px"&gt;002&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;banana&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;null&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;null&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&lt;BR /&gt;if it exist in the second query, I want to have a new field on my first query that says the ID of where it was found or "NOT FOUND".&lt;/P&gt;
&lt;TABLE border="1" width="781px"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="176.711px" height="25px"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;SQ1-user&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="176.75px" height="25px"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;SQ1-field1&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="176.742px" height="25px"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;SQ1-field2&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="87.9219px" height="25px"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;SQ1-field3&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="161.875px"&gt;&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;(NEW FIELD)SQ2-ID&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="176.711px" height="25px"&gt;john&lt;/TD&gt;
&lt;TD width="176.75px" height="25px"&gt;null&lt;/TD&gt;
&lt;TD width="176.742px" height="25px"&gt;null&lt;/TD&gt;
&lt;TD width="87.9219px" height="25px"&gt;apple&lt;/TD&gt;
&lt;TD width="161.875px"&gt;001&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="176.711px" height="25px"&gt;jane&lt;/TD&gt;
&lt;TD width="176.75px" height="25px"&gt;null&lt;/TD&gt;
&lt;TD width="176.742px" height="25px"&gt;orange&lt;/TD&gt;
&lt;TD width="87.9219px" height="25px"&gt;null&lt;/TD&gt;
&lt;TD width="161.875px"&gt;NOT FOUND&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="176.711px" height="25px"&gt;doe&lt;/TD&gt;
&lt;TD width="176.75px" height="25px"&gt;banana&lt;/TD&gt;
&lt;TD width="176.742px" height="25px"&gt;null&lt;/TD&gt;
&lt;TD width="87.9219px" height="25px"&gt;null&lt;/TD&gt;
&lt;TD width="161.875px"&gt;002&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Nov 2022 14:27:17 GMT</pubDate>
    <dc:creator>iammax</dc:creator>
    <dc:date>2022-11-22T14:27:17Z</dc:date>
    <item>
      <title>How to search using values from another search result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-using-values-from-another-search-result/m-p/619014#M215138</link>
      <description>&lt;P&gt;Please help...&lt;BR /&gt;&lt;BR /&gt;1st search query is where I get a value from the result. (value can be in either 1 of 3 fields)&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;index=index1 | table SQ1-user SQ1-field1 SQ1-field2 SQ1-field3&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="25%" height="25px"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;SQ1-user&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;SQ1-field1&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;SQ1-field2&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;SQ1-field3&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%" height="25px"&gt;john&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;null&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;null&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;apple&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%" height="25px"&gt;jane&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;null&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;orange&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;null&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%" height="25px"&gt;doe&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;banana&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;null&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;null&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&lt;BR /&gt;From that value, I want to use it to check if it exist in another search query, (the value can be on any fields)&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;index=index2 | where ANY_FIELD=SQ1-field1 OR ANY_FIELD=SQ1-field2 OR ANY_FIELD=SQ1-field3&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="25%" height="25px"&gt;&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;SQ2-ID&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;SQ2-field1&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;SQ2-field2&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;SQ2-field3&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%" height="25px"&gt;001&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;null&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;apple&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;null&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%" height="25px"&gt;002&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;banana&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;null&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;null&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&lt;BR /&gt;if it exist in the second query, I want to have a new field on my first query that says the ID of where it was found or "NOT FOUND".&lt;/P&gt;
&lt;TABLE border="1" width="781px"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="176.711px" height="25px"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;SQ1-user&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="176.75px" height="25px"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;SQ1-field1&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="176.742px" height="25px"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;SQ1-field2&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="87.9219px" height="25px"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;SQ1-field3&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="161.875px"&gt;&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;(NEW FIELD)SQ2-ID&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="176.711px" height="25px"&gt;john&lt;/TD&gt;
&lt;TD width="176.75px" height="25px"&gt;null&lt;/TD&gt;
&lt;TD width="176.742px" height="25px"&gt;null&lt;/TD&gt;
&lt;TD width="87.9219px" height="25px"&gt;apple&lt;/TD&gt;
&lt;TD width="161.875px"&gt;001&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="176.711px" height="25px"&gt;jane&lt;/TD&gt;
&lt;TD width="176.75px" height="25px"&gt;null&lt;/TD&gt;
&lt;TD width="176.742px" height="25px"&gt;orange&lt;/TD&gt;
&lt;TD width="87.9219px" height="25px"&gt;null&lt;/TD&gt;
&lt;TD width="161.875px"&gt;NOT FOUND&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="176.711px" height="25px"&gt;doe&lt;/TD&gt;
&lt;TD width="176.75px" height="25px"&gt;banana&lt;/TD&gt;
&lt;TD width="176.742px" height="25px"&gt;null&lt;/TD&gt;
&lt;TD width="87.9219px" height="25px"&gt;null&lt;/TD&gt;
&lt;TD width="161.875px"&gt;002&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2022 14:27:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-using-values-from-another-search-result/m-p/619014#M215138</guid>
      <dc:creator>iammax</dc:creator>
      <dc:date>2022-11-22T14:27:17Z</dc:date>
    </item>
    <item>
      <title>Re: Searching using values from another search result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-using-values-from-another-search-result/m-p/619019#M215140</link>
      <description>&lt;P&gt;It'll be easier if you can provide a sample query for the first and second search.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Oct 2022 20:42:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-using-values-from-another-search-result/m-p/619019#M215140</guid>
      <dc:creator>johnhuang</dc:creator>
      <dc:date>2022-10-31T20:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: Searching using values from another search result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-using-values-from-another-search-result/m-p/619021#M215141</link>
      <description>&lt;P&gt;just the basic query where you can get my sample result above. (i edited my post for sample query). I am confused on how to do the correlation and on the adding of the new field part.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Oct 2022 20:59:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-using-values-from-another-search-result/m-p/619021#M215141</guid>
      <dc:creator>iammax</dc:creator>
      <dc:date>2022-10-31T20:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: Searching using values from another search result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-using-values-from-another-search-result/m-p/619042#M215147</link>
      <description>&lt;P&gt;As&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/190794"&gt;@johnhuang&lt;/a&gt;&amp;nbsp;said, it is critical to illustrate data because a successful search strategy depends on data characteristics. &amp;nbsp;You really did yourself a great favor to update.&lt;/P&gt;&lt;P&gt;Now, I assume that those values that you displayed as "null" are actual null values. &amp;nbsp;What you wanted from this data can be easily achieved with &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/ConditionalFunctions#coalesce.28.26lt.3Bvalues.29" target="_blank" rel="noopener"&gt;coalesce&lt;/A&gt; function.&lt;/P&gt;&lt;P&gt;First, to address the "| where" filter.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index IN (index1, index2)
| eval SQ1-field = coalesce('SQ1-field1', 'SQ1-field2', 'SQ1-field3')
| eval SQ2-field = coalesce('SQ2-field1', 'SQ2-field2', 'SQ2-field3')
| where SQ1-field == SQ2-field
| table SQ1-user SQ1-field SQ2-ID&lt;/LI-CODE&gt;&lt;P&gt;When you use that | where, you cannot have that row with jane as the last table illustrates.&lt;/P&gt;&lt;P&gt;To make a new field as illustrated that includes "not found", do&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index IN (index1, index2)
| eval SQ1-field = coalesce('SQ1-field1', 'SQ1-field2', 'SQ1-field3')
| eval SQ2-field = coalesce('SQ2-field1', 'SQ2-field2', 'SQ2-field3')
| eval "(New field)SQ2-ID" = if('SQ2-field' == 'SQ1-field', 'SQ2-ID', "Not found")
| table SQ1-user SQ1-field '(New field)SQ2-ID'&lt;/LI-CODE&gt;&lt;P&gt;Now, if those "null" values are literal strings spelled as "null", you can always clean them up before proceeding, e.g.,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index IN (index1, index2)
| foreach SQ*-field*
  [eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; = if(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; == "null", null(), &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;)]
| eval SQ1-field = coalesce('SQ1-field1', 'SQ1-field2', 'SQ1-field3')
| eval SQ2-field = coalesce('SQ2-field1', 'SQ2-field2', 'SQ2-field3')
| eval "(New field)SQ2-ID" = if('SQ2-field' == 'SQ1-field', 'SQ2-ID', "Not found")
| table SQ1-user SQ1-field '(New field)SQ2-ID'&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 01 Nov 2022 04:57:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-using-values-from-another-search-result/m-p/619042#M215147</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-11-01T04:57:03Z</dc:date>
    </item>
    <item>
      <title>Re: Searching using values from another search result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-using-values-from-another-search-result/m-p/621608#M216069</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;, Thank you so much for the help.&lt;/P&gt;&lt;P&gt;I understand that in using coalesce, i can only get 1 value per user, but&amp;nbsp;what if both query1 and query2 has values in 2 or 3 fields? How can I check if any field on query1 matches in any field of query2?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;SQ1-user&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;SQ1-field1&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;SQ1-field2&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;SQ1-field3&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;john&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;berry&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;mango&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;apple&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;jane&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;berry&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;orange&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;null&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;doe&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;banana&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;null&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;null&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;EM&gt;&lt;U&gt;john&lt;/U&gt; have 3 fields with value / &lt;U&gt;jane&lt;/U&gt; have 2 fields with value / &lt;U&gt;doe&lt;/U&gt; have 1 field with value.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;SQ2-ID&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;SQ2-field1&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;SQ2-field2&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;SQ2-field3&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;001&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;null&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;apple&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;grapes&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;002&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;banana&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;pineapple&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;null&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;EM&gt;001 and 002 have 2 fields with value.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*** For &lt;STRONG&gt;SQ1-user john, &lt;/STRONG&gt;how can I check if any of the value in the 3 fields (&lt;U&gt;berry&lt;/U&gt; OR &lt;U&gt;mango&lt;/U&gt; OR &lt;U&gt;apple)&lt;/U&gt;&amp;nbsp;can match in any of the fields in query2?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Final Result should still be the same:&lt;/P&gt;&lt;TABLE border="1" width="781px"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="176.711px" height="47px"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;SQ1-user&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD width="176.75px" height="47px"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;SQ1-field1&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD width="176.734px" height="47px"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;SQ1-field2&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD width="87.9219px" height="47px"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;SQ1-field3&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD width="161.883px" height="47px"&gt;&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;(NEW FIELD)SQ2-ID&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="176.711px" height="25px"&gt;john&lt;/TD&gt;&lt;TD width="176.75px" height="25px"&gt;berry&lt;/TD&gt;&lt;TD width="176.734px" height="25px"&gt;mango&lt;/TD&gt;&lt;TD width="87.9219px" height="25px"&gt;apple&lt;/TD&gt;&lt;TD width="161.883px" height="25px"&gt;001&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="176.711px" height="25px"&gt;jane&lt;/TD&gt;&lt;TD width="176.75px" height="25px"&gt;berry&lt;/TD&gt;&lt;TD width="176.734px" height="25px"&gt;orange&lt;/TD&gt;&lt;TD width="87.9219px" height="25px"&gt;null&lt;/TD&gt;&lt;TD width="161.883px" height="25px"&gt;NOT FOUND&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="176.711px" height="25px"&gt;doe&lt;/TD&gt;&lt;TD width="176.75px" height="25px"&gt;banana&lt;/TD&gt;&lt;TD width="176.734px" height="25px"&gt;null&lt;/TD&gt;&lt;TD width="87.9219px" height="25px"&gt;null&lt;/TD&gt;&lt;TD width="161.883px" height="25px"&gt;002&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again in advance.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 16:44:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-using-values-from-another-search-result/m-p/621608#M216069</guid>
      <dc:creator>iammax</dc:creator>
      <dc:date>2022-11-21T16:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: Searching using values from another search result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-using-values-from-another-search-result/m-p/621634#M216079</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&amp;nbsp;what if both query1 and query2 has values in 2 or 3 fields? How can I check if any field on query1 matches in any field of query2?&lt;/BLOCKQUOTE&gt;&lt;P&gt;That is exactly why every helper on this forum emphasizes that you need to illustrate your data, including characteristics like this. &amp;nbsp;Otherwise others just waste time trying to read your mind.&lt;/P&gt;&lt;P&gt;Because the task is really just trying to match user with ID via &lt;EM&gt;any&lt;/EM&gt; field value, I'll assume that whether a match occurs in field1 or field2 or field3 is of no importance and simplify the output; you can still work out a way to preserve the original field ID if that's important. (Just take away all the stats and work them back in.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rename SQ*-field* as SQ*_field*
| foreach SQ*_field*
    [eval SQ_field = mvappend(SQ_field, &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;)]
| mvexpand SQ_field
| stats values(SQ1-user) as user values(SQ2-ID) as ID by SQ_field
| stats values(ID) as ID values(SQ_field) as SQ_field by user
| fillnull ID value="NOT FOUND"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;With your sample data, the output is&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;user&lt;/TD&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;SQ_field&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;doe&lt;/TD&gt;&lt;TD&gt;002&lt;/TD&gt;&lt;TD&gt;banana&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;jane&lt;/TD&gt;&lt;TD&gt;NOT FOUND&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;berry&lt;/DIV&gt;&lt;DIV class=""&gt;orange&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;john&lt;/TD&gt;&lt;TD&gt;001&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;apple&lt;/DIV&gt;&lt;DIV class=""&gt;berry&lt;/DIV&gt;&lt;DIV class=""&gt;mango&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2022 00:43:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-using-values-from-another-search-result/m-p/621634#M216079</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-11-22T00:43:04Z</dc:date>
    </item>
  </channel>
</rss>

