<?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: Join with different fields names. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Join-with-different-fields-names/m-p/46654#M11144</link>
    <description>&lt;P&gt;Rename certainly works.&lt;/P&gt;

&lt;P&gt;If you have two sources like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;user, field1
foo, value2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;userId, field2
foo, value2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;you can do a search like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=st1 | rename user as userId | join userId [search sourcetype=st2]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to get this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;userId, field1, field2
foo, value1, value2
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 27 May 2013 13:45:50 GMT</pubDate>
    <dc:creator>martin_mueller</dc:creator>
    <dc:date>2013-05-27T13:45:50Z</dc:date>
    <item>
      <title>Join with different fields names.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-with-different-fields-names/m-p/46653#M11143</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'm trying to port some SQL queries we wrote to Splunk but whereas with SQL I can specify which columns to join whatever their names are I couldn't replicate that in Splunk.&lt;/P&gt;

&lt;P&gt;Here's an attempt using aliases (rename didnt work either) :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   sourcetype="call"
    | join type=left callerID as userId
       [search sourcetype="user"
       | fields userId]
    | table event_id callerID userId
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks !&lt;/P&gt;</description>
      <pubDate>Mon, 27 May 2013 13:16:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-with-different-fields-names/m-p/46653#M11143</guid>
      <dc:creator>brodde</dc:creator>
      <dc:date>2013-05-27T13:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: Join with different fields names.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-with-different-fields-names/m-p/46654#M11144</link>
      <description>&lt;P&gt;Rename certainly works.&lt;/P&gt;

&lt;P&gt;If you have two sources like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;user, field1
foo, value2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;userId, field2
foo, value2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;you can do a search like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=st1 | rename user as userId | join userId [search sourcetype=st2]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to get this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;userId, field1, field2
foo, value1, value2
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 May 2013 13:45:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-with-different-fields-names/m-p/46654#M11144</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2013-05-27T13:45:50Z</dc:date>
    </item>
  </channel>
</rss>

