Pass SQL results from one input tool to the SQL statement of another input tool
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi,
I've looked through the Knowledge base and found dynamic input or reading from a saved file but couldn't find an answer to this issue.
Basically, I have a really large database that needs to be filtered by order numbers inputted from from another smaller database. How can I run the smaller database (Input Tool) and feed those results into the "where" portion of the SQL statement in the larger database (Input Tool #2) (eg. where order_number in (xxxx, xxx, xxxx, xxxx)).
Thanks,
Mark
Solved! Go to Solution.
- Labels:
- Common Use Cases
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You actually should be able to do this with just two tools - an initial input & a Dynamic Input. Some basic instructions below:
Essentially, your initial query is giving you the list of order numbers, and the second query can then take that list and replace an initial Where clause (that might just contain one order number for simplicity) with the list of order numbers from the original input. The Dynamic Input tool is one of my favorites for this reason - it is so often quite powerful when it comes to creating queries that pull from multiple worksheets, or from a new file each day, or a dynamic range of data, etc.
I hope this helps!
Cheers,
NJ
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I'm curious.. when you do this is it executing the dynamic query once for each row in the first input?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you, I'll test this out this week
