<?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: Equivalent of SQL WHERE IN Subquery clause? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Equivalent-of-SQL-WHERE-IN-Subquery-clause/m-p/446535#M126680</link>
    <description>&lt;P&gt;have you considered a join instead of a subquery it might be easier&lt;/P&gt;</description>
    <pubDate>Tue, 17 Jul 2018 22:22:40 GMT</pubDate>
    <dc:creator>kiamco</dc:creator>
    <dc:date>2018-07-17T22:22:40Z</dc:date>
    <item>
      <title>Equivalent of SQL WHERE IN Subquery clause?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Equivalent-of-SQL-WHERE-IN-Subquery-clause/m-p/446534#M126679</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I am looking for the equivalent of performing SQL like such:&lt;/P&gt;

&lt;P&gt;SELECT transaction_id, vendor&lt;BR /&gt;
FROM orders&lt;BR /&gt;
WHERE transaction_id IN (SELECT transaction_id FROM events).&lt;/P&gt;

&lt;P&gt;I am aware this a way to do this through a lookup, but I don't think it would be a good use case in this situation because there are constantly new transaction_id's generated and several thousand of them within a small timeframe, as well as my goal to create a timechart report.&lt;/P&gt;

&lt;P&gt;As of right now I can construct a list of transaction_ids for orders in one search query and a list of transaction_ids for events in another search query, but my ultimate goal is to return order logs that have transaction_ids shared with the transaction_ids of the events log. Any help is greatly appreciated, thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:30:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Equivalent-of-SQL-WHERE-IN-Subquery-clause/m-p/446534#M126679</guid>
      <dc:creator>ixixix_spl</dc:creator>
      <dc:date>2020-09-29T20:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: Equivalent of SQL WHERE IN Subquery clause?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Equivalent-of-SQL-WHERE-IN-Subquery-clause/m-p/446535#M126680</link>
      <description>&lt;P&gt;have you considered a join instead of a subquery it might be easier&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jul 2018 22:22:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Equivalent-of-SQL-WHERE-IN-Subquery-clause/m-p/446535#M126680</guid>
      <dc:creator>kiamco</dc:creator>
      <dc:date>2018-07-17T22:22:40Z</dc:date>
    </item>
    <item>
      <title>Re: Equivalent of SQL WHERE IN Subquery clause?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Equivalent-of-SQL-WHERE-IN-Subquery-clause/m-p/446536#M126681</link>
      <description>&lt;P&gt;You may want to have a look at the "Splunk SPL for SQL Users" manual (&lt;A href="http://docs.splunk.com/Documentation/Splunk/7.1.2/SearchReference/SQLtoSplunk"&gt;http://docs.splunk.com/Documentation/Splunk/7.1.2/SearchReference/SQLtoSplunk&lt;/A&gt;).&lt;/P&gt;

&lt;P&gt;See if this gets you started.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=orders vendor=* [ search index=events transaction_id=* | fields transaction_id | format ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Jul 2018 01:46:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Equivalent-of-SQL-WHERE-IN-Subquery-clause/m-p/446536#M126681</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2018-07-18T01:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: Equivalent of SQL WHERE IN Subquery clause?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Equivalent-of-SQL-WHERE-IN-Subquery-clause/m-p/446537#M126682</link>
      <description>&lt;P&gt;@kiamco can you give an example of how you would join two searches by a single field?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 23:57:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Equivalent-of-SQL-WHERE-IN-Subquery-clause/m-p/446537#M126682</guid>
      <dc:creator>ixixix_spl</dc:creator>
      <dc:date>2018-07-18T23:57:19Z</dc:date>
    </item>
    <item>
      <title>Re: Equivalent of SQL WHERE IN Subquery clause?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Equivalent-of-SQL-WHERE-IN-Subquery-clause/m-p/446538#M126683</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/126393"&gt;@ixixix_spl&lt;/a&gt; so I assuming that transaction_id is unique&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; first query
| table transcation_id
| join type=left transcation_id [|search second query
                                     |table orders]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;something like that but it gets a bit complicated depending on the fields you want to join but try it out see if it works&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:33:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Equivalent-of-SQL-WHERE-IN-Subquery-clause/m-p/446538#M126683</guid>
      <dc:creator>kiamco</dc:creator>
      <dc:date>2020-09-29T20:33:17Z</dc:date>
    </item>
  </channel>
</rss>

