<?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 Splunk DB connect multiple Db join in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Splunk-DB-connect-multiple-Db-join/m-p/35346#M178439</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Can Splunk DB connect (dbquery command) be used to join multiple databases? It tends to table 1 particular database as a paramter so I am not sure if multiple database join queries do actually work? Is it something planned in the next release of 2.0? When is 2.0 suppoed to be released?&lt;/P&gt;

&lt;P&gt;Regards&lt;BR /&gt;
Anshu&lt;/P&gt;</description>
    <pubDate>Sun, 17 Feb 2013 20:37:39 GMT</pubDate>
    <dc:creator>anshu2812</dc:creator>
    <dc:date>2013-02-17T20:37:39Z</dc:date>
    <item>
      <title>Splunk DB connect multiple Db join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-DB-connect-multiple-Db-join/m-p/35346#M178439</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Can Splunk DB connect (dbquery command) be used to join multiple databases? It tends to table 1 particular database as a paramter so I am not sure if multiple database join queries do actually work? Is it something planned in the next release of 2.0? When is 2.0 suppoed to be released?&lt;/P&gt;

&lt;P&gt;Regards&lt;BR /&gt;
Anshu&lt;/P&gt;</description>
      <pubDate>Sun, 17 Feb 2013 20:37:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-DB-connect-multiple-Db-join/m-p/35346#M178439</guid>
      <dc:creator>anshu2812</dc:creator>
      <dc:date>2013-02-17T20:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk DB connect multiple Db join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-DB-connect-multiple-Db-join/m-p/35347#M178440</link>
      <description>&lt;P&gt;Seems to me it would be more efficient and easier to do this join in the DB itself using a query containing the join, rather than sending both tables to Splunk and having it do it (using the &lt;CODE&gt;join&lt;/CODE&gt; search command). But if you're doing this from different databases (that don't otherwise talk to each other), then there's really not much that the DB Connect app can do to bring the data together, other than simply bring both sets into Splunk and allow you to run &lt;CODE&gt;stats&lt;/CODE&gt; or one of the other commands. (I will warn you that &lt;CODE&gt;join&lt;/CODE&gt; is usually one of the worst ways to get results in Splunk. Usually, &lt;CODE&gt;stats&lt;/CODE&gt; or other command are able to get the results much more efficiently.)&lt;/P&gt;</description>
      <pubDate>Sun, 17 Feb 2013 23:50:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-DB-connect-multiple-Db-join/m-p/35347#M178440</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2013-02-17T23:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk DB connect multiple Db join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-DB-connect-multiple-Db-join/m-p/35348#M178441</link>
      <description>&lt;P&gt;The dbquery command doesn't directly allow you to join data from multiple databases, but you can use the Splunk search language to combine results from multiple queries that can come from different databases:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| dbquery dbA "SELECT * FROM some_table" | join some_id [ dbquery dbB "SELECT * FROM another_table" ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In the example above, the results of both queries would be joined by the field/column "some_id". &lt;/P&gt;

&lt;P&gt;Another example would be to use the &lt;CODE&gt;append&lt;/CODE&gt; command to form a union of 2 query results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| dbquery dbA "SELECT * FROM some_table" | append [ dbquery dbB "SELECT * FROM another_table" ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Feb 2013 02:40:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-DB-connect-multiple-Db-join/m-p/35348#M178441</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2013-02-18T02:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk DB connect multiple Db join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-DB-connect-multiple-Db-join/m-p/35349#M178442</link>
      <description>&lt;P&gt;If i would like to join 2 databases, and may some subtraction in between, how can do that?&lt;/P&gt;

&lt;P&gt;Like this SQL:&lt;BR /&gt;
SELECT  A.msga, (A.REQUEST_DT_GMT + 8/24) - B.SUBMISSION_TIME) AS "TIME_DIFF"&lt;BR /&gt;
FROM    tablea A,&lt;BR /&gt;
        tableb B&lt;BR /&gt;
WHERE   A.msga = B.msgb&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 13:48:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-DB-connect-multiple-Db-join/m-p/35349#M178442</guid>
      <dc:creator>wongan3</dc:creator>
      <dc:date>2020-09-28T13:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk DB connect multiple Db join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-DB-connect-multiple-Db-join/m-p/35350#M178443</link>
      <description>&lt;P&gt;Unless I am missing something,&lt;/P&gt;

&lt;P&gt;I do this all the time. It's very easy if your DB's are on the same server. Just simply append the db name to the table in your FROM condition within the SQL statement. As long as you have the db connection specified to the server in splunks external db's, and your user has access.&lt;/P&gt;

&lt;P&gt;|dbquery {externalDbconnection} "Select a.field1, b.field2 FROM db1.table1 a JOIN db2.table2 b ON b.field2=a.field1"&lt;/P&gt;

&lt;P&gt;No need to do a join outside of the SQL&lt;/P&gt;</description>
      <pubDate>Sun, 20 Jul 2014 18:03:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-DB-connect-multiple-Db-join/m-p/35350#M178443</guid>
      <dc:creator>Cuyose</dc:creator>
      <dc:date>2014-07-20T18:03:27Z</dc:date>
    </item>
  </channel>
</rss>

