Use SQL Output In Where Clause of Another SQL Call

Your setup seems correct.

See this answer here: Pass a parameter to other module