Ah. That's going to be tricky. If you want to do it with VisualCron tasks like this, it would have to be a loop over all the results in task 1, and then call task2 with parameters for each iteration. Doing it in one go is not going to work (I think), because it would have to be an IN or EXIST statement to give you the correct results.
The query you have in Task 2, isn't going to work if {TASK(PrevTask,StdOut) has multiple rows.
Are these databases in different Sql Server instances?
If so, you have a couple of options. You can create linked servers in Sql server. Then you can query across different instances. Performance with linked servers can be bad, so only do this for light queries.
Or you can do it in .NET where you join the two datasets, but that's a bit more work.