This is asked often. Here is the best Q&A that I have seen (some answers may be slightly out of date):
https://answers.splunk.com/answers/310388/hungry-newbie-best-way-to-learn-splunk-well-effici.html
... View more
You are describing a subsearch :
https://docs.splunk.com/Documentation/Splunk/latest/Search/Aboutsubsearches
https://docs.splunk.com/Documentation/Splunk/latest/SearchTutorial/Useasubsearch
https://docs.splunk.com/Documentation/Splunk/latest/Search/Usesubsearchtocorrelateevents
... View more