<?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 db connect - input joining 3 tables in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/db-connect-input-joining-3-tables/m-p/63635#M180308</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;I have an issue trying to create an input with db connect that throws this error&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2013-06-12 11:29:23.417 dbx7796:ERROR:TailDatabaseMonitor - Configuration Error: Invalid query specified! Found multiple placeholders for condition - this is invalid.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The query is maybe too complex for db connect as we are joining 3 tables and using where clauses to match specific conditions. &lt;/P&gt;

&lt;P&gt;It's not clear in the documentation how complex we can make this query, so my guess is that this is probably too much for db connect?&lt;/P&gt;

&lt;P&gt;This is my query&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;select s.colb, s.colc, pos.cold, s.cole, s.colf, pos.colg, s.colh, pos.coli,
case when rm.razon is null and pos.coli = 'T2' then 'Pachin'
     when rm.razon is null and pos.coli != 'T2' then 'Other'
     else rm.razon
end as "REASON_V",
pos.comentarios, pos.cancel_coli, pos.cancel_comentarios
from schema.table1 s
left outer join schema.table3 pos
  on s.colp = pos.colp
  and pos.cole = 'PAPA'
left outer join schema.table2 rm
  on pos.coli = rm.coli
  and rm.razon = 'PAPA'
where s.cole = 'PAPA'
and s.cola_n = 1
and s.colb &amp;gt; trunc(sysdate-7)
order by s.colb desc;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 14 Jun 2013 00:03:39 GMT</pubDate>
    <dc:creator>asimagu</dc:creator>
    <dc:date>2013-06-14T00:03:39Z</dc:date>
    <item>
      <title>db connect - input joining 3 tables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/db-connect-input-joining-3-tables/m-p/63635#M180308</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;I have an issue trying to create an input with db connect that throws this error&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2013-06-12 11:29:23.417 dbx7796:ERROR:TailDatabaseMonitor - Configuration Error: Invalid query specified! Found multiple placeholders for condition - this is invalid.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The query is maybe too complex for db connect as we are joining 3 tables and using where clauses to match specific conditions. &lt;/P&gt;

&lt;P&gt;It's not clear in the documentation how complex we can make this query, so my guess is that this is probably too much for db connect?&lt;/P&gt;

&lt;P&gt;This is my query&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;select s.colb, s.colc, pos.cold, s.cole, s.colf, pos.colg, s.colh, pos.coli,
case when rm.razon is null and pos.coli = 'T2' then 'Pachin'
     when rm.razon is null and pos.coli != 'T2' then 'Other'
     else rm.razon
end as "REASON_V",
pos.comentarios, pos.cancel_coli, pos.cancel_comentarios
from schema.table1 s
left outer join schema.table3 pos
  on s.colp = pos.colp
  and pos.cole = 'PAPA'
left outer join schema.table2 rm
  on pos.coli = rm.coli
  and rm.razon = 'PAPA'
where s.cole = 'PAPA'
and s.cola_n = 1
and s.colb &amp;gt; trunc(sysdate-7)
order by s.colb desc;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Jun 2013 00:03:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/db-connect-input-joining-3-tables/m-p/63635#M180308</guid>
      <dc:creator>asimagu</dc:creator>
      <dc:date>2013-06-14T00:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: db connect - input joining 3 tables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/db-connect-input-joining-3-tables/m-p/63636#M180309</link>
      <description>&lt;P&gt;DB Connect does not limit the complexity of queries for database inputs. For the tail input mode they have to comply with some rules, though:&lt;/P&gt;

&lt;P&gt;1) They have to include an (exactly one) optional-condition-block &lt;CODE&gt;{{...}}&lt;/CODE&gt; to distinguish between the SQL used for initial- and any subsequent execution. For the initial execution this block is omitted, for any subsequent run, it's included.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ... {{ WHERE foo = ? }}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;2) This optional-condition-block has to include the (exactly one) placeholder for the checkpoint value &lt;CODE&gt;?&lt;/CODE&gt; which is replaced with the checkpoint value.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;? 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;3) There must not be any other value placeholders in the SQL (ie. only 1 unquoted &lt;CODE&gt;?&lt;/CODE&gt; within the SQL query)&lt;/P&gt;

&lt;P&gt;More info here &lt;A href="http://docs.splunk.com/Documentation/DBX/latest/DeployDBX/Configuredatabasemonitoring#Query_generation"&gt;http://docs.splunk.com/Documentation/DBX/latest/DeployDBX/Configuredatabasemonitoring#Query_generation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Jun 2013 16:24:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/db-connect-input-joining-3-tables/m-p/63636#M180309</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2013-06-16T16:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: db connect - input joining 3 tables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/db-connect-input-joining-3-tables/m-p/63637#M180310</link>
      <description>&lt;P&gt;thanks, I have read all the doc but I'm afraid my query is correct and it is still not working. I just edited my question in order to include my query&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2013 03:46:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/db-connect-input-joining-3-tables/m-p/63637#M180310</guid>
      <dc:creator>asimagu</dc:creator>
      <dc:date>2013-06-17T03:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: db connect - input joining 3 tables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/db-connect-input-joining-3-tables/m-p/63638#M180311</link>
      <description>&lt;P&gt;I can't find the &lt;CODE&gt;{{ .. }}&lt;/CODE&gt; part in your query.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2013 11:29:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/db-connect-input-joining-3-tables/m-p/63638#M180311</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2013-06-17T11:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: db connect - input joining 3 tables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/db-connect-input-joining-3-tables/m-p/63639#M180312</link>
      <description>&lt;P&gt;I did not type that in there, but that would go at the end.That is clear but I think I would like to have this working in the db connect app "Query database"&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2013 00:25:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/db-connect-input-joining-3-tables/m-p/63639#M180312</guid>
      <dc:creator>asimagu</dc:creator>
      <dc:date>2013-06-18T00:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: db connect - input joining 3 tables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/db-connect-input-joining-3-tables/m-p/63640#M180313</link>
      <description>&lt;P&gt;So it's not working in "Query database"? What error message do you get?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2013 17:36:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/db-connect-input-joining-3-tables/m-p/63640#M180313</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2013-06-18T17:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: db connect - input joining 3 tables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/db-connect-input-joining-3-tables/m-p/63641#M180314</link>
      <description>&lt;P&gt;the one that is at the beginning of the post &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2013 04:02:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/db-connect-input-joining-3-tables/m-p/63641#M180314</guid>
      <dc:creator>asimagu</dc:creator>
      <dc:date>2013-06-19T04:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: db connect - input joining 3 tables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/db-connect-input-joining-3-tables/m-p/63642#M180315</link>
      <description>&lt;P&gt;The error you're referring to is a from a database input and not from dbquery.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2013 14:58:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/db-connect-input-joining-3-tables/m-p/63642#M180315</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2013-06-19T14:58:17Z</dc:date>
    </item>
    <item>
      <title>Re: db connect - input joining 3 tables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/db-connect-input-joining-3-tables/m-p/63643#M180316</link>
      <description>&lt;P&gt;Why don't you create a view of the query and give a try?&lt;/P&gt;</description>
      <pubDate>Fri, 17 Oct 2014 13:19:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/db-connect-input-joining-3-tables/m-p/63643#M180316</guid>
      <dc:creator>asifhj</dc:creator>
      <dc:date>2014-10-17T13:19:24Z</dc:date>
    </item>
  </channel>
</rss>

