All Apps and Add-ons

Splunk DB Connect: How to edit my dbxquery to use a field value from one SELECT query in another SELECT query?

sharmasplunk
New Member
| dbxquery connection=DB1
query="SELECT field1 FROM table1 where field2=11193193" 
shortnames=1|RENAME field1 as field2| FIELDS SR_BUG_ID |appendcols [dbxquery connection="DB2" query="SELECT
field3 FROM table2 where field1 =field2" shortnames=1]|table *

when i am running this query, field2 is coming as unknown. Could you please tell me how i can use field1 value coming in first SELECT query in second SELECT query?

0 Karma

plynch52
Explorer

The sub query gets run before the rest of the query, so field2 has not been populated yet.
Dry making the first part the sub query

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...