<?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: Rewrite/Correspond MySQL Queries in Splunk in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-rewrite-correspond-MySQL-queries-in-Splunk/m-p/512847#M143854</link>
    <description>&lt;P&gt;What is exact field name of Status and accepted?&lt;/P&gt;&lt;P&gt;Check the field names I used in eval statement are matching with field names in Splunk.&lt;/P&gt;</description>
    <pubDate>Thu, 06 Aug 2020 19:10:35 GMT</pubDate>
    <dc:creator>thambisetty</dc:creator>
    <dc:date>2020-08-06T19:10:35Z</dc:date>
    <item>
      <title>How to rewrite/correspond MySQL queries in Splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rewrite-correspond-MySQL-queries-in-Splunk/m-p/512838#M143850</link>
      <description>&lt;P&gt;Hey community I have my data in both MySQL and in Splunk. I'm trying to mimic the MySQL queries in Splunk so I can make a visual. My Data has five columns,:"Month", "Project", "Status", "Completion", "Points". The first query sums the column "Points" only if that row includes a Status and Completion value of "Done" and then grouping it by Month. The second query is summing the column points just by the Month.&lt;BR /&gt;&lt;BR /&gt;The problem I'm running into is having them together in one Splunk Query as I'm trying to have both tables in one graph. Any suggestions?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;select Month,sum(Points) from TABLE
 where Status = "Done"
 and Completion = "Done"
 group by Month
 ;
&amp;amp;
 select Month,sum(Points)from TABLE
 group by Month
 ;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 19:04:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rewrite-correspond-MySQL-queries-in-Splunk/m-p/512838#M143850</guid>
      <dc:creator>Username1</dc:creator>
      <dc:date>2020-08-06T19:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: Rewrite/Correspond MySQL Queries in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rewrite-correspond-MySQL-queries-in-Splunk/m-p/512841#M143851</link>
      <description>&lt;P&gt;index=index&lt;/P&gt;&lt;P&gt;| eval done=if(Status=“Done” AND Accepted=“Done”,Points&lt;SPAN&gt;,“0”)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;| stats sum(Points) as all_points, sum(done) as done_points by Month&lt;/P&gt;&lt;P&gt;Sample output&lt;/P&gt;&lt;P&gt;———-&lt;/P&gt;&lt;P&gt;Month all_points done_points&lt;/P&gt;&lt;P&gt;Jan &amp;nbsp;10 5&lt;/P&gt;&lt;P&gt;Feb 20 10&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;done will have points when status and accepted value is done. sum(done) renamed to done_points this will have sum of points where status and accepted is done by month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hope this answers your question.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 18:55:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rewrite-correspond-MySQL-queries-in-Splunk/m-p/512841#M143851</guid>
      <dc:creator>thambisetty</dc:creator>
      <dc:date>2020-08-06T18:55:25Z</dc:date>
    </item>
    <item>
      <title>Re: Rewrite/Correspond MySQL Queries in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rewrite-correspond-MySQL-queries-in-Splunk/m-p/512843#M143852</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/129407"&gt;@thambisetty&lt;/a&gt;&amp;nbsp; Thanks for the response&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I ran your query and it is showing a blank for done_points&lt;BR /&gt;&lt;BR /&gt;It returns the below, but done_points is all null&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Month | all_points| done_points&lt;/P&gt;&lt;P&gt;Jan&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&amp;nbsp; 10&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |&lt;/P&gt;&lt;P&gt;Feb&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&amp;nbsp; &amp;nbsp;20&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Any thoughts on why that may be happening?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 19:01:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rewrite-correspond-MySQL-queries-in-Splunk/m-p/512843#M143852</guid>
      <dc:creator>Username1</dc:creator>
      <dc:date>2020-08-06T19:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: Rewrite/Correspond MySQL Queries in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rewrite-correspond-MySQL-queries-in-Splunk/m-p/512847#M143854</link>
      <description>&lt;P&gt;What is exact field name of Status and accepted?&lt;/P&gt;&lt;P&gt;Check the field names I used in eval statement are matching with field names in Splunk.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 19:10:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rewrite-correspond-MySQL-queries-in-Splunk/m-p/512847#M143854</guid>
      <dc:creator>thambisetty</dc:creator>
      <dc:date>2020-08-06T19:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: Rewrite/Correspond MySQL Queries in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rewrite-correspond-MySQL-queries-in-Splunk/m-p/512854#M143857</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/129407"&gt;@thambisetty&lt;/a&gt;&amp;nbsp; The exact field names are Status and Accepted.&lt;BR /&gt;I have made sure that the field names are correct and the single quotes are correct as well.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 19:27:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rewrite-correspond-MySQL-queries-in-Splunk/m-p/512854#M143857</guid>
      <dc:creator>Username1</dc:creator>
      <dc:date>2020-08-06T19:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: Rewrite/Correspond MySQL Queries in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rewrite-correspond-MySQL-queries-in-Splunk/m-p/512858#M143858</link>
      <description>&lt;P&gt;Can you post your query here please?&lt;/P&gt;&lt;P&gt;and also remove last stats and run search and check if you are seeing new field done or not in the fields?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 19:30:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rewrite-correspond-MySQL-queries-in-Splunk/m-p/512858#M143858</guid>
      <dc:creator>thambisetty</dc:creator>
      <dc:date>2020-08-06T19:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: Rewrite/Correspond MySQL Queries in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rewrite-correspond-MySQL-queries-in-Splunk/m-p/512860#M143859</link>
      <description>&lt;P&gt;Here is my current query&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=index
| table Month, Project, Status, Accepted, Points
| eval done = if(Status= 'Done' AND Accepted = 'Done',Points,'0')
| stats sum(Points) as all_points, sum(done) as done_points by Month&lt;/LI-CODE&gt;&lt;P&gt;I removed the last |stats and it shows theres no results for "done".&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 19:37:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rewrite-correspond-MySQL-queries-in-Splunk/m-p/512860#M143859</guid>
      <dc:creator>Username1</dc:creator>
      <dc:date>2020-08-06T19:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: Rewrite/Correspond MySQL Queries in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rewrite-correspond-MySQL-queries-in-Splunk/m-p/512863#M143860</link>
      <description>&lt;LI-CODE lang="markup"&gt;index=index
| table Month, Project, Status, Accepted, Points
| eval done = if(Status= "Done" AND Accepted = "Done",Points,'0')
| stats sum(Points) as all_points, sum(done) as done_points by Month&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;The error was in the double and single quotes, that is my mistake...Thanks you&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/129407"&gt;@thambisetty&lt;/a&gt;&amp;nbsp; for all of your help!&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 19:40:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rewrite-correspond-MySQL-queries-in-Splunk/m-p/512863#M143860</guid>
      <dc:creator>Username1</dc:creator>
      <dc:date>2020-08-06T19:40:39Z</dc:date>
    </item>
    <item>
      <title>Re: Rewrite/Correspond MySQL Queries in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rewrite-correspond-MySQL-queries-in-Splunk/m-p/512864#M143861</link>
      <description>&lt;P&gt;Run this query as it is.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;index=index&lt;/P&gt;&lt;P&gt;| eval done=if(Status=“Done” AND Accepted=“Done”,Points&lt;SPAN&gt;,“0”)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;| stats sum(Points) as all_points, sum(done) as done_points by Month&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you replaced double quotes with single quotes in eval statement.&amp;nbsp;&lt;BR /&gt;if eval is throwing an error for some reason just remove double quotes and input them from your keyboard.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 19:41:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rewrite-correspond-MySQL-queries-in-Splunk/m-p/512864#M143861</guid>
      <dc:creator>thambisetty</dc:creator>
      <dc:date>2020-08-06T19:41:32Z</dc:date>
    </item>
  </channel>
</rss>

