Reputation: 123
I have a relatively simple query already that works:
SELECT last("total") FROM "DB" WHERE ("type" = 'stats' AND "name" =~ /^TV$/) AND $timeFilter
However, what I want is to find all records where "name" CONTAINS "TV" instead of starts with or equals "TV" since I have items such as "MY_TV" and "Wife_TV" that should all fall into query. Seems simple enough, but having a hard time finding the syntax to complete the query. I know there is not a LIKE feature as in SQL, but not sure what the best path would be. Could it be done with Regex somehow? Or using the "strings.Index" feature of influxDB but inside the SELECT/WHERE?
Read a ton of previous questions and other documentations, but having issues with putting it all together into a query that works. Any guidance is appreciated.
Upvotes: 1
Views: 8692
Reputation: 123
I feel a bit silly not realizing this was already RegEx as built. The solution was simple:
SELECT last("total") FROM "DB" WHERE ("type" = 'stats' AND "name" =~ /TV/) AND $timeFilter
Figured rather than delete out of embarrassment, I would answer for someone else to stumble upon one day.
Upvotes: 3