<?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 join with one key but multiple results? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-with-one-key-but-multiple-results/m-p/604035#M210126</link>
    <description>&lt;P&gt;Hi I have a table similar to this:&lt;/P&gt;
&lt;P&gt;Brand ID_EMP&lt;/P&gt;
&lt;P&gt;Nike 123&lt;/P&gt;
&lt;P&gt;Adidas 456&lt;/P&gt;
&lt;P&gt;Lotto 123&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;other table like this:&lt;/P&gt;
&lt;P&gt;code name&lt;/P&gt;
&lt;P&gt;123 Smith&lt;/P&gt;
&lt;P&gt;456 Myers&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The result should be&lt;/P&gt;
&lt;P&gt;Nike 123 Smith&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Adidas 456 Myers&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lotto 123 Smith&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but insted of this I'm getting:&lt;/P&gt;
&lt;P&gt;Nike 123 Smith john&lt;/P&gt;
&lt;P&gt;adidas 456 Myers. Mike&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the query that I'm using.&lt;/P&gt;
&lt;P&gt;| dbxquery query="SELECT * FROM Clients ;" connection="Clients"&lt;BR /&gt;| where NOT like(SAFE_NAME,"S0%")&lt;BR /&gt;|rename ID_EMP as code&lt;BR /&gt;| join type=left [|&amp;nbsp; inputlookup append=t Emp.csv&lt;BR /&gt;| table code, name, STATUS&lt;BR /&gt;]| fillnull value="Blank" STATUS&lt;BR /&gt;| dedup code&lt;BR /&gt;| where STATUS!="Blank"&lt;/P&gt;</description>
    <pubDate>Thu, 30 Jun 2022 22:29:28 GMT</pubDate>
    <dc:creator>fereze</dc:creator>
    <dc:date>2022-06-30T22:29:28Z</dc:date>
    <item>
      <title>How to join with one key but multiple results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-with-one-key-but-multiple-results/m-p/604035#M210126</link>
      <description>&lt;P&gt;Hi I have a table similar to this:&lt;/P&gt;
&lt;P&gt;Brand ID_EMP&lt;/P&gt;
&lt;P&gt;Nike 123&lt;/P&gt;
&lt;P&gt;Adidas 456&lt;/P&gt;
&lt;P&gt;Lotto 123&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;other table like this:&lt;/P&gt;
&lt;P&gt;code name&lt;/P&gt;
&lt;P&gt;123 Smith&lt;/P&gt;
&lt;P&gt;456 Myers&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The result should be&lt;/P&gt;
&lt;P&gt;Nike 123 Smith&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Adidas 456 Myers&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lotto 123 Smith&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but insted of this I'm getting:&lt;/P&gt;
&lt;P&gt;Nike 123 Smith john&lt;/P&gt;
&lt;P&gt;adidas 456 Myers. Mike&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the query that I'm using.&lt;/P&gt;
&lt;P&gt;| dbxquery query="SELECT * FROM Clients ;" connection="Clients"&lt;BR /&gt;| where NOT like(SAFE_NAME,"S0%")&lt;BR /&gt;|rename ID_EMP as code&lt;BR /&gt;| join type=left [|&amp;nbsp; inputlookup append=t Emp.csv&lt;BR /&gt;| table code, name, STATUS&lt;BR /&gt;]| fillnull value="Blank" STATUS&lt;BR /&gt;| dedup code&lt;BR /&gt;| where STATUS!="Blank"&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2022 22:29:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-with-one-key-but-multiple-results/m-p/604035#M210126</guid>
      <dc:creator>fereze</dc:creator>
      <dc:date>2022-06-30T22:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to join with one key but multiple results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-with-one-key-but-multiple-results/m-p/604053#M210131</link>
      <description>&lt;P&gt;Please find the sample query with the data points, hope it helps you to change your query accordingly -&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Also, in most of the cases you can skip using join command if one of your datasources is a lookupfile, you can use |lookup filename.csv command in those cases.&lt;BR /&gt;&lt;BR /&gt;Considering the below is in lookupfile emp.,csv&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;code name
123 Smith
456 Myers&lt;/LI-CODE&gt;&lt;P&gt;Final Query -&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval BRAND_EMPID="Nike,123;Adidas,456;Lotto,123" 
| makemv delim=";" BRAND_EMPID 
| mvexpand BRAND_EMPID 
| eval Brand=mvindex(split(BRAND_EMPID,","),0) 
| eval ID_EMP=mvindex(split(BRAND_EMPID,","),1) 
| table Brand ID_EMP 
| lookup emp.csv Code AS ID_EMP
| table Brand ID_EMP NAME&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;Let me know if the above query helped or if you feel anything needs to be changed in the above example.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2022 22:42:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-with-one-key-but-multiple-results/m-p/604053#M210131</guid>
      <dc:creator>nadlurinadluri</dc:creator>
      <dc:date>2022-06-30T22:42:48Z</dc:date>
    </item>
  </channel>
</rss>

