<?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 lookup the same field from another search and different fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-lookup-the-same-field-from-another-search-and-different/m-p/688310#M234675</link>
    <description>&lt;P&gt;Try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;my search command for transaction records&amp;gt;
| dedup orderId
| table  orderId, sellerId, buyerId
| append
[ search &amp;lt;my search command for list user rating list&amp;gt;
| table user, rating]
| eval user=if(isnull(sellerId), user, sellerId)
| eventstats values(rating) as sellerRating by user
| eval user=if(isnull(buyerId), user, buyerId)
| eventstats values(rating) as buyerRating by user
| where isnotnull(orderId)
| table orderId, sellerId, buyerId, sellerRating,buyerRating&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 22 May 2024 12:16:12 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2024-05-22T12:16:12Z</dc:date>
    <item>
      <title>How to lookup the same field from another search and different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-lookup-the-same-field-from-another-search-and-different/m-p/688287#M234674</link>
      <description>&lt;P&gt;my search as below, the two&amp;nbsp;&amp;lt;my search command for list user rating list&amp;gt; search command is the same, how to reduce this search command.&lt;/P&gt;
&lt;P&gt;I want to use once time &amp;lt;my search command for list user rating list&amp;gt;, mean share the same search results for queries. The&amp;nbsp;transaction sellerId and buyerId could look up user of rating list to get the rating data.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;my search command for transaction records&amp;gt;
| dedup orderId
| table  orderId, sellerId, buyerId
| join type=left sellerId
[ search &amp;lt;my search command for list user rating list&amp;gt;
| table sellerId, sellerRating]
| search orderId!=""
| table orderId, sellerId, buyerId, sellerRating
| join type=left buyerId
[ search &amp;lt;my search command for list user rating list&amp;gt;
| table buyerId, buyerRating]
| search orderId!=""
| table orderId, sellerId, buyerId, sellerRating,buyerRating&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;transaction records maybe like as below&lt;/P&gt;
&lt;TABLE border="1" width="56.25%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="25%" height="25px"&gt;orderId&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;sellerId&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;buyerId&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%" height="39px"&gt;123&lt;/TD&gt;
&lt;TD width="25%" height="39px"&gt;John&lt;/TD&gt;
&lt;TD width="25%" height="39px"&gt;Marry&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%" height="25px"&gt;456&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;Alex&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;Josh&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;user rating (all user)&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;user&lt;/TD&gt;
&lt;TD width="50%"&gt;rating&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;Josh&lt;/TD&gt;
&lt;TD width="50%"&gt;10&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;Alex&lt;/TD&gt;
&lt;TD width="50%"&gt;-2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Lisa&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;Marry&lt;/TD&gt;
&lt;TD width="50%"&gt;3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;John&lt;/TD&gt;
&lt;TD width="50%"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;Tim&lt;/TD&gt;
&lt;TD width="50%"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;excepted result&lt;/P&gt;
&lt;TABLE border="1" width="93.0718954248366%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="25%"&gt;orderId&lt;/TD&gt;
&lt;TD width="12.5%"&gt;sellerId&lt;/TD&gt;
&lt;TD width="12.5%"&gt;buyerId&lt;/TD&gt;
&lt;TD width="25%"&gt;sellerRating&lt;/TD&gt;
&lt;TD width="25%"&gt;buyerRating&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%"&gt;123&lt;/TD&gt;
&lt;TD width="12.5%"&gt;John&lt;/TD&gt;
&lt;TD width="12.5%"&gt;Marry&lt;/TD&gt;
&lt;TD width="25%"&gt;0&lt;/TD&gt;
&lt;TD width="25%"&gt;3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%"&gt;456&lt;/TD&gt;
&lt;TD width="12.5%"&gt;Alex&lt;/TD&gt;
&lt;TD width="12.5%"&gt;Josh&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;-2&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;10&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Wed, 22 May 2024 12:00:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-lookup-the-same-field-from-another-search-and-different/m-p/688287#M234674</guid>
      <dc:creator>mia</dc:creator>
      <dc:date>2024-05-22T12:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to lookup the same field from another search and different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-lookup-the-same-field-from-another-search-and-different/m-p/688310#M234675</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;my search command for transaction records&amp;gt;
| dedup orderId
| table  orderId, sellerId, buyerId
| append
[ search &amp;lt;my search command for list user rating list&amp;gt;
| table user, rating]
| eval user=if(isnull(sellerId), user, sellerId)
| eventstats values(rating) as sellerRating by user
| eval user=if(isnull(buyerId), user, buyerId)
| eventstats values(rating) as buyerRating by user
| where isnotnull(orderId)
| table orderId, sellerId, buyerId, sellerRating,buyerRating&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 22 May 2024 12:16:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-lookup-the-same-field-from-another-search-and-different/m-p/688310#M234675</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-05-22T12:16:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to lookup the same field from another search and different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-lookup-the-same-field-from-another-search-and-different/m-p/688377#M234691</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your solution, it's very useful.&lt;/P&gt;&lt;P&gt;I also have a question about&lt;/P&gt;&lt;P&gt;1. when to use join and append&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. when to use search and where, like search oid!=""&amp;nbsp; v.s.&amp;nbsp;where isnotnull(orderId)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 17:19:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-lookup-the-same-field-from-another-search-and-different/m-p/688377#M234691</guid>
      <dc:creator>mia</dc:creator>
      <dc:date>2024-05-22T17:19:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to lookup the same field from another search and different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-lookup-the-same-field-from-another-search-and-different/m-p/688379#M234692</link>
      <description>&lt;P&gt;1) avoid join where possible - it is expensive on resources and slow&lt;/P&gt;&lt;P&gt;2) it depends on your comparison&lt;BR /&gt;&lt;A href="https://docs.splunk.com/Documentation/SCS/current/SearchReference/WhereCommandUsage#Comparing_two_fields" target="_blank"&gt;https://docs.splunk.com/Documentation/SCS/current/SearchReference/WhereCommandUsage#Comparing_two_fields&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 17:26:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-lookup-the-same-field-from-another-search-and-different/m-p/688379#M234692</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-05-22T17:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to lookup the same field from another search and different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-lookup-the-same-field-from-another-search-and-different/m-p/688391#M234695</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for you&amp;nbsp;explication,I'll review and rewrite my others search query statements.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2024 01:41:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-lookup-the-same-field-from-another-search-and-different/m-p/688391#M234695</guid>
      <dc:creator>mia</dc:creator>
      <dc:date>2024-05-23T01:41:15Z</dc:date>
    </item>
  </channel>
</rss>

