<?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: How do I do SQL-like MINUS? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-do-SQL-like-MINUS/m-p/209760#M61336</link>
    <description>&lt;P&gt;Oh.. I should have made some clarifications. There are multiple events associate with a single orderID. Some events have status=failure and some events have status=success. An orderID will be considered as successful if one of its event has status=success.&lt;/P&gt;

&lt;P&gt;I am looking for orderID with all of its associate events with status=failure.&lt;/P&gt;</description>
    <pubDate>Fri, 04 Nov 2016 00:07:26 GMT</pubDate>
    <dc:creator>chatsai</dc:creator>
    <dc:date>2016-11-04T00:07:26Z</dc:date>
    <item>
      <title>How do I do SQL-like MINUS?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-do-SQL-like-MINUS/m-p/209757#M61333</link>
      <description>&lt;P&gt;&lt;STRONG&gt;All OrderId&lt;/STRONG&gt;&lt;BR /&gt;
This query gives all distinct orderID&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;basesearch  | dedup orderID | table orderID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This query gives all distinct orderID with status=success&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;basesearch status=success | dedup orderID | table orderID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How do I find a table with all the failed orderID with a single nested query?&lt;BR /&gt;
I have tried the following query&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| set diff [search basesearch  | dedup orderID | table orderID] [search basesearch status=sucess | dedup orderID | table orderID]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But it is not returning the failed orders.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 22:40:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-do-SQL-like-MINUS/m-p/209757#M61333</guid>
      <dc:creator>chatsai</dc:creator>
      <dc:date>2016-11-03T22:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: How do I do SQL-like MINUS?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-do-SQL-like-MINUS/m-p/209758#M61334</link>
      <description>&lt;P&gt;What is returned when you do&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;basesearch status!=sucess | dedup orderID | table orderID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;basesearch status=failure | dedup orderID | table orderID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(By the way, be sure to use the correct criteria, either "success" or "sucess")&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 23:32:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-do-SQL-like-MINUS/m-p/209758#M61334</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2016-11-03T23:32:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do I do SQL-like MINUS?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-do-SQL-like-MINUS/m-p/209759#M61335</link>
      <description>&lt;P&gt;Oh, should have mentioned one last option:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;basesearch NOT status=sucess | dedup orderID | table orderID
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Nov 2016 23:59:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-do-SQL-like-MINUS/m-p/209759#M61335</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2016-11-03T23:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: How do I do SQL-like MINUS?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-do-SQL-like-MINUS/m-p/209760#M61336</link>
      <description>&lt;P&gt;Oh.. I should have made some clarifications. There are multiple events associate with a single orderID. Some events have status=failure and some events have status=success. An orderID will be considered as successful if one of its event has status=success.&lt;/P&gt;

&lt;P&gt;I am looking for orderID with all of its associate events with status=failure.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2016 00:07:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-do-SQL-like-MINUS/m-p/209760#M61336</guid>
      <dc:creator>chatsai</dc:creator>
      <dc:date>2016-11-04T00:07:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do I do SQL-like MINUS?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-do-SQL-like-MINUS/m-p/209761#M61337</link>
      <description>&lt;P&gt;No problem, I sort of figured that had to be a reason why it's not that easy.  &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;But, maybe ...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;basesearch | transaction orderID | search NOT status=success
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;There might be tweaking, but when you create a transaction out of these, if there are multiple values for a particular status it will add them all.  (If there's only one, it collapses it to a single entry).  So then you should be able to search where there is no "status=success" in the piled-up transaction like we do.&lt;/P&gt;

&lt;P&gt;There are other ways to accomplish this, but that one might work.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2016 00:14:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-do-SQL-like-MINUS/m-p/209761#M61337</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2016-11-04T00:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: How do I do SQL-like MINUS?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-do-SQL-like-MINUS/m-p/209762#M61338</link>
      <description>&lt;P&gt;Given that:&lt;BR /&gt;
1) There are multiple events associated with a single orderID where orderID acts as primary key to track these events.&lt;BR /&gt;
2) orderID is considered success if even one event is successful&lt;BR /&gt;
3) Looking for orderID with all of its associate events with status=failure&lt;/P&gt;

&lt;P&gt;then can you try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base query NOT [ your base query status=success | dedup orderID | table orderID ]
  | dedup orderID
   | table orderID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;this should remove all the orderID related events from the search where you had atleast one success. The remaining ones are the ones with neither success nor partial success.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2016 00:51:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-do-SQL-like-MINUS/m-p/209762#M61338</guid>
      <dc:creator>gokadroid</dc:creator>
      <dc:date>2016-11-04T00:51:45Z</dc:date>
    </item>
  </channel>
</rss>

