Splunk Search

How to join two tables?

jvmerilla
Path Finder

Hi All,

I have a search:
| savedsearch Cycle_11
| append
[| savedsearch Cycle_10]

with the results:
alt text

The result I want is something like this:
alt text

What do I need to do to get the result I want?
I have tried appendcols but the results is somehow messed up.

Note:
Both savedsearch returns more than 30,000 results.

I hope someone can help me with this.

Thanks in advance and Best Regards 🙂

Tags (2)
0 Karma

mayurr98
Super Champion

Can you try this :

| savedsearch Cycle_11 | appendcols [| savedsearch Cycle_10]

let me know if this helps!

0 Karma

jvmerilla
Path Finder

HI @mayurr98,

I already tried appendcols but the problem is that the result is messed up.
The alignment of some of the fields is wrong because there are some fields with no values.

0 Karma

FrankVl
Ultra Champion

I'm a bit puzzled at what your (functional) end goal is here. Might be good to explain that (perhaps also rethink it yourself), to get some good suggestions on how to accomplish it.

Glueing tables together like this does not make a whole lot of sense to me. But if you really need that, we would at least need a definition of how the tables should be glued together. In other words: how should splunk decide which rows from one table to merge with rows from the other table?

0 Karma

HiroshiSatoh
Champion

Try this!

| savedsearch Cycle_11 | append [| savedsearch Cycle_10]
|rename Field_1* as  Field_1
|stats  latest(*) AS * BY ID,Name,Field_1
0 Karma

jvmerilla
Path Finder

Hi @HiroshiSatoh,

Why do I have to rename fields?

0 Karma

jvmerilla
Path Finder

I tried it but I got this error:

Error in 'rename' command: Wildcard mismatch:
0 Karma

HiroshiSatoh
Champion

It was a mistake. "rename" is for use with By.

| savedsearch Cycle_11 | append [| savedsearch Cycle_10]
|rename Field_1(CYCLE 10) as Field_1
|rename Field_1(CYCLE 11) as Field_1
|stats latest(*) AS * BY ID,Name,Field_1

0 Karma

493669
Super Champion

Try this:

| savedsearch Cycle_11 | join ID [| savedsearch Cycle_10]
0 Karma

jvmerilla
Path Finder

I already tried join but what happen was that it duplicates the "Skill 12 from Field_1(CYCLE 10) and the 2 from Field_2(CYCLE 10).

It looks something like this:

ID Name Field_1(CYCLE 10) Field_2(CYCLE 10) Field_1(CYCLE 11) Field_2(CYCLE 11)
123 James Skill 11 0 Skill 11 0
123 James Skill 12 2 Skill 12 2
123 James Skill 12 2 Skill 13 0

0 Karma

493669
Super Champion

try this:

| savedsearch Cycle_11 | append [| savedsearch Cycle_10]|eval "Field_1"=coalesce('Field_1(CYCLE 11)','Field_1(CYCLE 10)')|stats values(*) as *  BY Field_1|table ID Name *
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...

SPL2 Deep Dives, AppDynamics Integrations, SAML Made Simple and Much More on Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...