WHERE IN clause

Anyone use this before where the contents of IN are dynamic?
I need to create a query where the contents of the WHERE IN (x,y,z) are the result of a another query. Only way I can figure out to do it is in scripting, where I have to build the contents of (x,y,z) with various strings.
Is there a simplier way?

Not really. To be really safe, you should construct a variable number of ‘?’ placeholders, then pass the appropriate length list of values in a Prep query. Bindings generally aren’t sufficiently flexible, which is why I created objectScript(), my generic “get out of jail free” card.

If you aren’t manipulating the results of the other query you can do something like this.

SELECT * FROM Table1 WHERE ID IN (SELECT ID FROM Table2)

[quote=“jpark”]If you aren’t manipulating the results of the other query you can do something like this.

SELECT * FROM Table1 WHERE ID IN (SELECT ID FROM Table2)[/quote]

Thanks Jae,
that worked for me :

[code]SELECT

a.t_stamp as 'Time',
b.Description as 'Tecnal Mold',
a.tank as 'Ferm Tank',
a.prodQty as 'Ferm Qty',
a.rennet/1000 as 'Rennet Inject',
a.runid

FROM

tecnal a
LEFT JOIN tecnalproducts b ON a.productID = b.id

WHERE RunID IN
(SELECT
a.ID

				FROM
					htstruns a

				WHERE
					Silo1ID = {Root Container.SiloID.value} OR
					Silo2ID = {Root Container.SiloID.value}	
			)

[/code]