<?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 tables in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/join-tables/m-p/510049#M142586</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/223303"&gt;@jotaforense&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;let me understand: are you using Splunk DB Connect like an Oracle client to run on line queries or&amp;nbsp;you have two inputs, one for each query that store results in one or two indexes?&lt;/P&gt;&lt;P&gt;in the first case, the easiest way is to create a join between the two queries and run only one query that extracts the fields you need.&lt;/P&gt;&lt;P&gt;In the second one, you can correlate two data flows, something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index=index1 sourcetype=sourcetype1) OR (index=index2 sourcetype=sourcetype2)
| stats values(NR_CARD) AS NR_CARD values(DT_CARD) AS DT_CARD values(DS_EMAIL) AS DS_EMAIL values(DS_NAME) AS DS_NAME COUNT BY ID_USER &lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Mon, 20 Jul 2020 14:44:05 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2020-07-20T14:44:05Z</dc:date>
    <item>
      <title>join tables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-tables/m-p/510048#M142585</link>
      <description>&lt;P&gt;I would like to obtain the results of two tables.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;| dbxquery query = "select * from table1 " connection = "Connection1"&lt;/P&gt;&lt;P&gt;Fields table1:&lt;/P&gt;&lt;P&gt;ID_USER&amp;nbsp;| NR_CARD&amp;nbsp;| DT_CARD&lt;/P&gt;&lt;P&gt;| dbxquery query = "select * from table2 " connection = "Connection1"&lt;/P&gt;&lt;P&gt;Fields table2:&amp;nbsp;&lt;BR /&gt;ID_USER&amp;nbsp;| DS_EMAIL | DS_NAME&lt;/P&gt;&lt;P&gt;the common fields between the two tables is: "ID_USER".&lt;BR /&gt;How to join tables 1 and 2 and transfer all fields?&lt;/P&gt;&lt;P&gt;[table1 / 2] ID_USER | [table1] | NR_CARD | [table1] DT_CARD | [table2] DS_EMAIL&amp;nbsp;| [table2] DS_NAME&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 14:33:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-tables/m-p/510048#M142585</guid>
      <dc:creator>jotaforense</dc:creator>
      <dc:date>2020-07-20T14:33:14Z</dc:date>
    </item>
    <item>
      <title>Re: join tables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-tables/m-p/510049#M142586</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/223303"&gt;@jotaforense&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;let me understand: are you using Splunk DB Connect like an Oracle client to run on line queries or&amp;nbsp;you have two inputs, one for each query that store results in one or two indexes?&lt;/P&gt;&lt;P&gt;in the first case, the easiest way is to create a join between the two queries and run only one query that extracts the fields you need.&lt;/P&gt;&lt;P&gt;In the second one, you can correlate two data flows, something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index=index1 sourcetype=sourcetype1) OR (index=index2 sourcetype=sourcetype2)
| stats values(NR_CARD) AS NR_CARD values(DT_CARD) AS DT_CARD values(DS_EMAIL) AS DS_EMAIL values(DS_NAME) AS DS_NAME COUNT BY ID_USER &lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 14:44:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-tables/m-p/510049#M142586</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-07-20T14:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: join tables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-tables/m-p/510050#M142587</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I'm using the first case!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 14:50:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-tables/m-p/510050#M142587</guid>
      <dc:creator>jotaforense</dc:creator>
      <dc:date>2020-07-20T14:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: join tables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-tables/m-p/510068#M142592</link>
      <description>&lt;P&gt;can you help me how does the join between these two tables work?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 16:48:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-tables/m-p/510068#M142592</guid>
      <dc:creator>jotaforense</dc:creator>
      <dc:date>2020-07-20T16:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: join tables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-tables/m-p/510172#M142754</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/223303"&gt;@jotaforense&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;sorry but I haven't the knowledge on SQL to do this (many years ago!).&lt;/P&gt;&lt;P&gt;I have only one think to add: this isn't a good approach to Splunk because this solution is very slow, the best approach is to:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;periodically extract data from DB,&lt;/LI&gt;&lt;LI&gt;store them in one index,&lt;/LI&gt;&lt;LI&gt;use the data from index.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jul 2020 06:43:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-tables/m-p/510172#M142754</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-07-21T06:43:26Z</dc:date>
    </item>
  </channel>
</rss>

