All Apps and Add-ons

Splunk DB Connect 1: How to find Open Tickets with no closed date in one dbquery search?

hartfoml
Motivator

I have a database that has a trend table. In the trend table there are two entries for each ticket: One for open date and one for closed date.

I want to find the open tickets that do not have an entry for closed. If I use a join or append, then I am essentially doing the search twice: one to find open tickets and one to find closed tickets, then compare and show only tickets that do not have closed date.

I have almost 2 million tickets on the table. How would I find open events that do not have a corresponding closed event with only one search?

Would it make more sense to do this during the SQL query?

| dbquery "TicketDB" "SELECT "TicketID" FROM Trend WHERE ChangeType NOT like "closed" AND ChangeType like "open" " 

this didn't work

0 Karma

somesoni2
Revered Legend

Doing it in SQL query (as part dbquery) will require selfjoin. Since, I'm not an expert of that so, I'm not even going there.

Here is how same thing can be achieved in Splunk (please adjust the SQL on dbquery per yours)

| dbquery "TicketDB "SELECT TicketID, ChangeType FROM Trend" | stats dc(ChangeType) as StatusCount values(ChangeType) as ChangeType by TicketID | where StatusCount=1 AND ChangeType="open"
0 Karma
Get Updates on the Splunk Community!

.conf25 Community Recap

Hello Splunkers, And just like that, .conf25 is in the books! What an incredible few days — full of learning, ...

Splunk App Developers | .conf25 Recap & What’s Next

If you stopped by the Builder Bar at .conf25 this year, thank you! The retro tech beer garden vibes were ...

Congratulations to the 2025-2026 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...