Skip to content
Advertisement

using Query one results to run Query two

This code would result with this

Result

What I would like to do is when the code above gets the results my bottom code reads them and runs them trough its code. The common denominator here would be the account number because its running through a different table

I have tried doing this the code below but it doesnt seem to work

Advertisement

Answer

IN is not an equivalent to a join – but you are treating that way.

Instead think of “IN this LIST” and the list could be supplied by you, or by a subquery e.g.

a list given by the query itself

or, using a subquery

or, if using a CTE

note, it usually is not more efficient to use select distinct when forming a subquery to be used with an IN list.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement