Using Output from one SQL Query in a different SQL Query

Check this out: Set additionalScope data to triggerQuery when called from a component